summaryrefslogtreecommitdiff
path: root/template/extinit.c.tmpl
blob: 7a9c910633bae35af2dca34d3443dbdcb114459f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
%# -*- C -*-
% extinits = ARGV.map {|n| [n[%r[[^/.]+(?=\.[^/]*)?\z]], n]}
#include "ruby/ruby.h"

#define init(func, name) {	\
    extern void func(void);	\
    ruby_init_ext(name".so", func); \
}

void ruby_init_ext(const char *name, void (*init)(void));

void Init_ext(void)
{
% extinits.each do |f, n|
    init(Init_<%=f%>, <%=n.dump%>);
% end
}