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
nobu 638ba47303 load.c: defer static linked init
* enc/encinit.c.erb (Init_enc): initialize encdb and transdb
  directly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-03 07:47:37 +00:00

37 lines
882 B
Text

/* Copyright 2012 Google Inc. Some Rights Reserved.
* Author: yugui@google.com (Yugui Sonoda)
*/
#include <stdio.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 : -%>