John Conrad
unread,Apr 30, 2013, 10:17:31 AM4/30/13You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
All code is compiled with -dll option (RIP-related addressing) with
latest version of lcc64
//This will crash:
//---------------------
#include <windows.h>
#include <stdio.h>
DWORD WINAPI thread(DWORD *p);
int main()
{
DWORD tid;
CloseHandle(CreateThread(NULL,0,thread,NULL,0,&tid));
loop:; Sleep(0); goto loop;
}
DWORD WINAPI thread(DWORD *p)
{
printf("Hello, Jacob, i'm cool thread, but i will crash\n");
}
//This will work:
//-------------------
#include <windows.h>
#include <stdio.h>
DWORD WINAPI thread(DWORD *p)
{
printf("Hello, Jacob, i'm cool thread and i will work, becouse i'm
located before CreateThread\n");
}
int main()
{
DWORD tid;
CloseHandle(CreateThread(NULL,0,thread,NULL,0,&tid));
loop:; Sleep(0); goto loop;
}
//And this will work (WINAPI removed):
//---------------------
#include <windows.h>
#include <stdio.h>
DWORD thread(DWORD *p); // WINAPI removed
int main()
{
DWORD tid;
CloseHandle(CreateThread(NULL,0,thread,NULL,0,&tid));
loop:; Sleep(0); goto loop;
}
DWORD WINAPI thread(DWORD *p)
{
printf("Hello, Jacob, i'm cool thread and located after CreateThread,
but i will work - WINAPI removed \n");
}
===============
Is this a bug? Or how should i correctly declare the thread - with or
without WINAPI for 64 bit ?