?Hi all,
Can someone tell me how to import functions from shared libraries and
use them in LLVM assembly
Regards,
Dylan Borg
+356 99214902
borgdylan at hotmail.com
borgdylang at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20101225/77e1182c/attachment.html>
Hi Dylan,
If you have "import libraries", you may call them with general calling
conversions.
Without import libraries, for example;
declare dllimport i32 @foo(i32)
@quux = dllimport global i32
define i32 @bar() nounwind {
%a = load i32* @quux
%r = call i32 @foo(i32 %a)
ret i32 %r
}
.globl _bar
_bar:
subl $4, %esp
movl __imp__quux, %eax
movl (%eax), %eax
movl %eax, (%esp)
calll *__imp__foo
addl $4, %esp
ret
If you have clang or llvm-gcc, you can confirm outputs with
clang foo.c -S -emit-llvm -o foo.ll
clang foo.c -S -o foo.s
...Takumi
Doh! 2010/12/27 NAKAMURA Takumi <geek4civic at gmail.com>:> If you have "import libraries", you may call them with general calling > conversions. > > Without import libraries, for example;You will need import libraries! If you use GNU ld, you may refer to *.dll directly, w/o import libraries nor deffiles. Then ld will generate stubs. ...Takumi
Maybe Matching Threads
- [LLVMdev] LLVM dllimport
- make dllimport/dllexport attributes work with mingw (and others)
- make dllimport/dllexport attributes work with mingw (and others)
- make dllimport/dllexport attributes work with mingw (and others)
- Function calls keep increasing the stack usage