1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/enc/encinit.c.erb
Peter Zhu 638fd8774b [Feature #18249] Include ruby.h in extensions to have ABI version
All shared libraries must have `include/ruby/internal/abi.h` to include
the ABI version. Including `ruby.h` will guarantee that.
2022-02-22 09:55:21 -05:00

38 lines
900 B
Text

/* Copyright 2012 Google Inc. Some Rights Reserved.
* Author: yugui@google.com (Yugui Sonoda)
*/
#include <stdio.h>
#include "ruby.h"
#define init(func, name) { \
extern void func(void); \
ruby_init_ext(name, func); \
}
#define init_enc(name) init(Init_##name, "enc/"#name".so")
#define init_trans(name) init(Init_trans_##name, "enc/trans/"#name".so")
#define provide(func, name) { \
extern void Init_##func(void); \
Init_##func(); \
rb_provide(name".so"); \
}
void ruby_init_ext(const char *name, void (*init)(void));
void rb_provide(const char *feature);
void
Init_enc(void)
{
provide(encdb, "encdb");
% ENCS.each do |enc|
% next if enc == 'encdb'
init_enc(<%= enc %>);
% end
provide(transdb, "trans/transdb");
% TRANS.each do |trans|
% next if trans == 'trans/transdb'
init_trans(<%= File.basename trans %>);
% end
}
<%# vim: set ft=eruby sw=2 : -%>