fprintf ob "};\n";
(* dump struct init func *)
- fprintf ob "\nstatic void %s_init(void)\n{\n" pkg.name;
+ fprintf ob "\nstatic void (%s_init)(void)\n{\n" pkg.name;
List.iter (function (m, _, _) ->
if not (fst m.typ) then
let init, f, l = m.init in
%s_init();
/* create methods table, add it the the table of globals */
- luaL_openlib(L, \"%s\", luaM_%s_methods, 0);
+ luaL_register(L, \"%s\", luaM_%s_methods);
methods = lua_gettop(L);
lua_newtable(L); /* for new members */
let warn ob = output_endline ob "/*** THIS FILE IS AUTOGENERATED !!! ***/"
let process fn file l =
- try Unix.unlink file with _ -> ();
+ (try Unix.unlink file with _ -> ());
let ob = open_out_gen [ Open_trunc ; Open_wronly; Open_creat ] 0o444 file in
warn ob; fn ob l; close_out ob