[LLVMdev] Question on using GlobalVariable as function pointer
ChiaLun
h3355626 at msn.com
Sun Jan 6 18:38:09 PST 2013
Hi everyone,
I am trying to have an call instruction that calls global variable
The first thing I do is
gv = new llvm::GlobalVariable( *(tb->getModule()),
fty,
false,GlobalValue::InternalLinkage,0,
"",0,0,0);
fty : i32 ({ i32, [32 x i32] }*)
I get stuck here, the fifth argument is the initializer which is a LLVM
Constant,
I do not know how to describe a function pointer as a constant.
so currently, I just pass false to it.
then I use
myjit->getOrEmitGlobalVariable(gv); // myjit is LLVM ExecutionEngine
but, I get an error
LLVM ERROR: Could not resolve external global address
However, when I modify fty to be an integer type or some primitive type,
there is no error.
Since LLVM demo page is closed, so I am not sure how to do it correctly.
Have A Nice Day
Chia Lun Liu
--
View this message in context: http://llvm.1065342.n5.nabble.com/Question-on-using-GlobalVariable-as-function-pointer-tp53187.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.
More information about the llvm-dev
mailing list