From 447b2de2a379abfaef279b7c6b95de89b82ea1e5 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 22 Jan 2017 12:50:36 +0000 Subject: template/extinit.c.tmpl * template/extinit.c.tmpl: separate from ext/extmk.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- template/extinit.c.tmpl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 template/extinit.c.tmpl (limited to 'template') diff --git a/template/extinit.c.tmpl b/template/extinit.c.tmpl new file mode 100644 index 0000000000..592eb0452f --- /dev/null +++ b/template/extinit.c.tmpl @@ -0,0 +1,16 @@ +%# -*- C -*- +#include "ruby/ruby.h" + +#define init(func, name) { \ + extern void func(void); \ + ruby_init_ext(name, func); \ +} + +void ruby_init_ext(const char *name, void (*init)(void)); + +void Init_ext(void) +{ +% ARGV.each do |n| + init(Init_<%=n.sub(/,(.*)/, ', "\1.so"')%>); +% end +} -- cgit v1.2.3