[cfe-dev] LLVM/Clang Windows XP 32bit - MessageBox

Ruben Van Boxem vanboxem.ruben at gmail.com
Fri Dec 9 03:14:43 PST 2011


Op 9 dec. 2011 11:48 schreef "Peter Hanzel" <hanzelpeter at gmail.com> het
volgende:
>
> 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?

Did you define the winver macro correctly? Does the problem still occur
then?

Ruben
>
> Peter.
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111209/66c59135/attachment.html>


More information about the cfe-dev mailing list