<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Well, the only place I need to get a variable pointer (pointer to a
symbol) from its name, is in intern function.<br>
And symbols are implemented as Python classes, so to LLVM IR they
appear as PyObjects, or, more precisely, as i8*'s.<br>
But all the elementary functions, that operate on symbols (e.g.
cons) are written with the in mind.<br>
<br>
Then, for functions I could have done just that: write a wrapper
around get_function_by_name method of Module object.<br>
However, this will give me PyObject*, not a pointer to an actual
function, which I suppose should be fed to call instruction.<br>
<br>
Then, maybe, question can be rephrased as: "how to obtain function
pointer from Function llvmpy's object"?<br>
<br>
On 05/04/2014 05:24 PM, Alexander Potapenko wrote:<br>
<blockquote
cite="mid:CAG_fn=W9M0jB6NA3YVHebvhjA9ONG33aBjE8dc=EZbSFYMH28Q@mail.gmail.com"
type="cite">
<p dir="ltr">Don't you have the same problem with other atoms,
e.g. variable names?<br>
This sounds like something that should be implemented in the
language's runtime library.</p>
<div class="gmail_quote">On May 4, 2014 7:15 PM, "Alexander
Popolitov" <<a moz-do-not-send="true"
href="mailto:popolit@gmail.com">popolit@gmail.com</a>>
wrote:<br type="attribution">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi everyone!<br>
<br>
I'm trying to implement lisp's funcall function, which roughly
calls a function, name of which<br>
is known only at runtime.<br>
I know that LLVM IR 'call' directive can accept function
pointers, so the question is,<br>
is there a simple way to get a function pointer from a
function name (represented as e.g. i8*)?<br>
<br>
BTW, I'm using llvmpy to generate LLVM IR, so if there is a
way to do this using llvmpy tools, it would also do.<br>
<br>
Yours sincerely,<br>
Alexandr Popolitov<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a moz-do-not-send="true" href="mailto:LLVMdev@cs.uiuc.edu"
target="_blank">LLVMdev@cs.uiuc.edu</a> <a
moz-do-not-send="true" href="http://llvm.cs.uiuc.edu"
target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a moz-do-not-send="true"
href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev"
target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote>
</div>
</blockquote>
<br>
</body>
</html>