[LLVMdev] Linking with C Library

Graham Wakefield wakefield at mat.ucsb.edu
Mon Apr 5 19:05:46 PDT 2010

If the OCaml bindings include the functionality in  
llvm::sys::DynamicLibrary, perhaps you can use the functions there to  
manually request the puts symbol?

e.g. llvm::sys::DynamicLibrary::LoadLibraryPermanently() and  
llvm::sys::DynamicLibrary::SearchForAddressOfSymbol() ...?

Just a thought.

On Apr 5, 2010, at 6:56 PM, Jeffrey Yasskin wrote:

> On Mon, Apr 5, 2010 at 3:27 PM, Nyx <mcheva at cs.mcgill.ca> wrote:
>>>> You need to figure out how to pass -rdynamic to the linker, like I
>> said before. http://llvm.org/docs/tutorial/OCamlLangImpl7.html
>> mentions it, but I don't know enough about the ocaml build process to
>> say whether that'll work.
>> I believe I'm already doing that, properly by passing -ccopt - 
>> rdynamic to
>> ocamlopt:
>> ocamlopt -cc g++ -ccopt -rdynamic -linkall $(LIBFILES) -o alpha $ 
>> I've also tried writing a dummy "puts" function in a C file and  
>> linking that
>> with my executable. nm -D then shows the following:
>> 000000000054b690 T camlRuntime__rt_fputs_208
>> 000000000054b590 T camlRuntime__rt_puts_198
>>                 U fputs
>> 0000000000c43044 T puts
>> However, LLVM *still* gives me:
>> LLVM ERROR: Tried to execute an unknown external function: i32  
>> (i8*)* puts
>> Something really wrong is happening. The following thread seems to  
>> indicate
>> that this should all work easily:
>> http://old.nabble.com/jit-with-external-functions-td7769793.html
> Ok, you've passed my expertise. Maybe you have to link with -lc?
> Hopefully one of the ocaml experts will chime in.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

More information about the llvm-dev mailing list