2017-01-22 15:50:36 +03:00
|
|
|
%# -*- C -*-
|
2017-01-23 05:19:00 +03:00
|
|
|
% extinits = ARGV.map {|n| [n[%r[[^/.]+(?=\.[^/]*)?\z]], n]}
|
2017-01-22 15:50:36 +03:00
|
|
|
#include "ruby/ruby.h"
|
|
|
|
|
|
|
|
#define init(func, name) { \
|
|
|
|
extern void func(void); \
|
2017-01-23 05:19:00 +03:00
|
|
|
ruby_init_ext(name".so", func); \
|
2017-01-22 15:50:36 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void ruby_init_ext(const char *name, void (*init)(void));
|
|
|
|
|
|
|
|
void Init_ext(void)
|
|
|
|
{
|
2017-01-23 05:19:00 +03:00
|
|
|
% extinits.each do |f, n|
|
|
|
|
init(Init_<%=f%>, <%=n.dump%>);
|
2017-01-22 15:50:36 +03:00
|
|
|
% end
|
|
|
|
}
|