MCPcopy Create free account
hub / github.com/digego/extempore / get_function_pointer

Method get_function_pointer

src/SchemeFFI.cpp:2473–2494  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2471 }
2472
2473 pointer SchemeFFI::get_function_pointer(scheme* _sc, pointer args)
2474 {
2475 using namespace llvm;
2476
2477 //Module* M = EXTLLVM::I()->M;
2478 //llvm::Function* func = M->getFunction(std::string(string_value(pair_car(args))));
2479 llvm::Function* func = extemp::EXTLLVM::I()->getFunction(std::string(string_value(pair_car(args))));
2480 //func->setCallingConv(CallingConv::C); //kCStackBased);
2481 if(func == 0)
2482 {
2483 return _sc->F;
2484 }
2485 // this should be safe without a lock
2486 void* p = EXTLLVM::I()->EE->getPointerToFunction(func);
2487
2488 if(p==NULL) {
2489 //[[LogView sharedInstance] error:@"LLVM: Bad Function Ptr\n"];
2490 return _sc->F;
2491 }
2492
2493 return mk_cptr(_sc, p);
2494 }
2495
2496 pointer SchemeFFI::llvm_call_void_native(scheme* _sc, pointer args)
2497 {

Callers

nothing calls this directly

Calls 4

string_valueFunction · 0.85
pair_carFunction · 0.85
mk_cptrFunction · 0.85
getFunctionMethod · 0.80

Tested by

no test coverage detected