MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / jit_init_extern_function

Function jit_init_extern_function

src/builtin/module_jit.cpp:340–372  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

338 }
339
340 DAS_API void jit_init_extern_function ( const char * moduleName,
341 const char * funcMangledName,
342 void ** dllGlobal ) {
343 bool found = false;
344 Module::foreach([&](Module * module) -> bool {
345 if ( module->name != moduleName ) return true;
346 auto fn = module->findFunction(funcMangledName);
347 if ( fn && fn->builtIn ) {
348 *dllGlobal = static_cast<BuiltInFunction *>(fn)->getBuiltinAddress();
349 found = *dllGlobal != nullptr;
350 return !found;
351 }
352 return true;
353 });
354 if ( !found && strcmp(moduleName, "dasbind") == 0 && strncmp(funcMangledName, "@dasbind::__dasbind__", 21) == 0 ) {
355 Module::foreach([&](Module * module) -> bool {
356 if ( module->name != "dasbind" ) return true;
357 auto resolverFn = module->findUniqueFunction("__dasbind_resolve");
358 if ( resolverFn && resolverFn->builtIn ) {
359 auto resolver = (void * (*)(const char *))
360 static_cast<BuiltInFunction *>(resolverFn)->getBuiltinAddress();
361 if ( resolver ) {
362 *dllGlobal = resolver(funcMangledName);
363 found = *dllGlobal != nullptr;
364 }
365 }
366 return false;
367 });
368 }
369 if (!found) {
370 DAS_FATAL_ERROR("Failed to find %s in module %s.\n", funcMangledName, moduleName);
371 }
372 }
373
374 DAS_API Annotation *jit_get_annotation ( const char * moduleName,
375 const char * annName ) {

Callers

nothing calls this directly

Calls 3

findUniqueFunctionMethod · 0.80
findFunctionMethod · 0.45
getBuiltinAddressMethod · 0.45

Tested by

no test coverage detected