[LLVMdev] Ответ: using dynamic libraries from bytecode?
Chris Lattner
sabre at nondot.org
Wed Jun 18 22:21:11 PDT 2008
On Jun 18, 2008, at 12:27 PM, Yaroslav Kavenchuk wrote:
> Mike Stump wrote:
>>> Is it possible to use dynamic library (*.so *.dll) from bytecode?
>>> If "yes" - how?
>>
>> dlopen? That's be one way. Also, most systems have shared libraries
>> in /usr/lib and these routines are meant to be linked against and
>> used. For example, on darwin, there sinf is resolved from a shared
>> library, you declare it and call it, as normal. You should be able
>> to
>> use llvm-gcc to see the bytecode of such a use of a routine from a
>> dynamic library.
>>
>
> Thanks! But... small example (mingw):
> $ llvm-gcc.exe -I/mingw/include gcd_ui.c -L/mingw/lib -lgmp -o
> gcd_ui.exe
>
> $ ./gcd_ui.exe
> All works!
>
> $ lli gcd_ui.bc
> ERROR: Program used external function '__gmpz_init_set_ui' which could
> not be resolved!
>
> This application has requested the Runtime to terminate it in an
> unusual way.
> Please contact the application's support team for more information.
Try: lli -load /path/to/foo.so gcd_ui.bc
Replace ".so" with ".dylib" or ".dll" as appropriate.
-Chris
More information about the llvm-dev
mailing list