On 12/8/06, Chris Lattner <sabre at nondot.org>
wrote:> On Fri, 8 Dec 2006, Ram Bhamidipaty wrote:
> > Can I place references to external functions in the assembler files?
For example
> > I if my application has a function called fred() I would like to place
> > calls to fred
> > in the assembler text file. Can I do that and have the external
function call
> > resolve to the address of fred() in my application?
>
> Yes, you can do this. The JIT will transparently call dlsym on the main
> process to resolve external function calls. This allows it to find
> standard lib functions like printf, it also allows your code to call into
> your own functions.
Will it also handle symbols that are in shared libraries loaded into
the process?
I am creating a python module that has the llvm functionality. This
module is loaded
into the process as a shared library. I want to generate llvm assembler that has
calls to functions in this shared library.
I just tried an experiment and I got this back:
ERROR: Program used external function 'rtcg_callback' which could not
be resolved!
Aborted
It looks like the additional shared libraries might not be searched. I
plan on looking at
the code to see if I can modify it to handle my case. Any suggestions
on how or where
I should make the change?
Thanks for the info.
-Ram