Creating a LLVM Execution Engine for Interpreter

Hello All,

I am using LLVM-8.0 and creating an Execution Engine as below of kind Interpreter. Am I doing it right Please let me know.

int loadIRFile__name(const char *filename) {

LLVMContext *contextHandle = new LLVMContext();

SMDiagnostic error;

// Load the bitcode from the .bc file
Module *moduleHandle = parseIRFile(filename, error, *me).release(); 

return (intptr_t) moduleHandle; 


int EngineBuilder__create(moduleHandle) {

std::unique_ptr<Module> parModule((Module*) moduleHandle);

EngineBuilder *engineBuilder = new EngineBuilder(std::move(parModule));

return (intptr_t) engineBuilder;


void EngineBuilder__setInterpreter(ebHandle) {

EngineBuilder *eb = (EngineBuilder*)_me;



int ExecutionEngine__build(ebHandle) {

EngineBuilder *me = (EngineBuilder*)ebHandle;

ExecutionEngine *executionEngine = me->create();

return (intptr_t) executionEngine;


I need to return the pointer as int

Best regards