I wrote the following code:
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Metadata.h"
using namespace llvm;
int main() {
int a=0,b=0,c=0;
Instruction *I;
LLVMContext& C = I->getContext();
MDNode* N = MDNode::get(C, MDString::get(C, "my md string content"));
I->setMetadata("my.md.name", N);
if(a>b){
c=a;
cast<MDString>(I->getMetadata("my.md.name")->getOperand(0))->getString();
}
else
c=b;
return c;
}
When I try to run this code with lli, it generates the following error:
"LLVM ERROR: unable to find external function '___ZXXcONTEXT4LS' that can't be resolved!"
Can you help me solve this problem? I'm aware about the LIBFFI project. Unfortunately, LIBFFI still has problems in running on windows platform. Is there any other solution to this?