[cfe-dev] LLVM/Clang Windows XP 32bit - MessageBox
Peter Hanzel
hanzelpeter at gmail.com
Fri Dec 9 02:42:08 PST 2011
Hello.
I have downloaded CLANG 3.0 and successfuly build on Windows XP.
Now I tried to compile this simple MessageBox Win32 Api program:
#include <windows.h>
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
lpCmdLine, int nCmdShow) {
MessageBox(NULL, "hello msgbox world\n", "Title", MB_OK);
return 0;
}
I did it this way:
clang -c -emit-llvm main.c
llc -filetype obj main.o -o test.obj
link test.obj user32.lib msvcrt.lib
But when I run test.exe I get : The procedure entry point
InterlockedCompareExchange64 could not be located in dynamic link library
KERNEL32.dll.
So I dissassembled main.o and there is usage of: (attached to mail)
declare dllimport x86_stdcallcc i64 @InterlockedCompareExchange64(i64*, i64,
i64)
But I think this is valid only for 64bit or Vista and more.
So I deleted whole stuff which is not needed to compile it.
Then with:
llvm-dis main.o
edit main.o.ll --remove 64bit stuff
llvm-as main.o.ll -o main.o
llc -filetype obj main.o -o test.obj
link test.obj user32.lib msvcrt.lib
And I got valid test.exe application, which also works.
So my question is: Is this Adding of unwanted stuff correct or is it some
kind of bug?
Peter.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.o.ll
Type: application/octet-stream
Size: 26656 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111209/255eb943/attachment.obj>
More information about the cfe-dev
mailing list