Dynamic __loadprim(String inLib, String inPrim,int inArgCount) { String full_name = inPrim; switch(inArgCount) { case 0: full_name += HX_CSTRING("__0"); break; case 1: full_name += HX_CSTRING("__1"); break; case 2: full_name += HX_CSTRING("__2"); break; case 3: full_name += HX_CSTRING("__3"); break; case 4: full_name += HX_CSTRING("__4"); break; case 5: full_name += HX_CSTRING("__5"); break; default: full_name += HX_CSTRING("__MULT"); } void *proc = __hxcpp_get_proc_address(inLib,full_name,true); if (proc) { // Split this to avoid a collect after ExternalPrimitive::new, but before its // inline constructor is run... String primName = inLib+HX_CSTRING("@")+full_name; return Dynamic( new ExternalPrimitive(proc,inArgCount,primName) ); } return null(); }
void __hxcpp_run_dll(String inLib, String inFunc) { typedef void (*VoidVoid)(); void *result = __hxcpp_get_proc_address(inLib,inFunc,false); if (result) ((VoidVoid)result)(); }
Dynamic __loadprim(String inLib, String inPrim,int inArgCount) { String full_name = inPrim; switch(inArgCount) { case 0: full_name += HX_CSTRING("__0"); break; case 1: full_name += HX_CSTRING("__1"); break; case 2: full_name += HX_CSTRING("__2"); break; case 3: full_name += HX_CSTRING("__3"); break; case 4: full_name += HX_CSTRING("__4"); break; case 5: full_name += HX_CSTRING("__5"); break; default: full_name += HX_CSTRING("__MULT"); } void *proc = __hxcpp_get_proc_address(inLib,full_name,true); if (proc) return Dynamic( new ExternalPrimitive(proc,inArgCount,inLib+HX_CSTRING("@")+full_name) ); return null(); }