[LLVMdev] LLVM dllimport

NAKAMURA Takumi geek4civic at gmail.com
Sun Dec 26 18:11:04 PST 2010


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



More information about the llvm-dev mailing list