LLVM dllimport

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@hotmail.com
borgdylang@gmail.com

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!