mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
638fd8774b
All shared libraries must have `include/ruby/internal/abi.h` to include the ABI version. Including `ruby.h` will guarantee that.
38 lines
900 B
Text
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 : -%>
|