support loading native functions from the main program using special `builtin` name
useful when embedding hashlink
@@ -244,6 +244,9 @@ int hl_module_init( hl_module *m, void *stack_top_val ) {
if( curlib != n->lib ) {
curlib = n->lib;
strcpy(tmp,n->lib);
+ if( strcmp(n->lib,"builtin") == 0 )
+ libHandler = dlopen(NULL,RTLD_LAZY);
+ else {
if( strcmp(n->lib,"std") == 0 )
# ifndef HL_WIN
libHandler = RTLD_DEFAULT;
@@ -264,6 +267,7 @@ int hl_module_init( hl_module *m, void *stack_top_val ) {
}
# endif
}
+ }
strcpy(p,"hlp_");
p += 4;
strcpy(p,n->name);
