[Wine] wine: could not load and Bad EXE format for
huutri
wineforum-user at winehq.org
Mon Dec 15 02:57:19 CST 2008
Hi All,
I have tried to write dll from window and try to implement a WineLib wrapper.
BUT after compile successful, I have run the function, it show me error as below:
wine: could not load L"Z:\\root\\huutri\\maintest.exe.so": Bad EXE format for
Can anybody can how to solve this problem?
Thank in advance
The below is some code:
Code:
1. windows HelloImpl.dll
__declspec(dllexport) void sayHello(char* sMsg);
__declspec(dllexport) void writeNUM(int num);
__declspec(dllexport) void printfString(char* sMsg);
2. winedump
winedump spec -f dump HelloImpl.dll -I "*.h"
Contents of "HelloImpl.dll": 49152 bytes
3 named symbols in DLL, 3 total, 3 unique (ordinal base = 1)
Done dumping HelloImpl.dll
Export 1 - '?printfString@@YAXPAD at Z' ... [OK]
Export 2 - '?sayHello@@YAXPAD at Z' ... [OK]
Export 3 - '?writeNUM@@YAXH at Z' ... [OK]
3. Winegcc to make so (Share Object)
winegcc HelloImpl.spec -o libhelloimpl HelloImpl_main.c -shared -fPIC
4. write a c main function to try to call the so
#include "HelloImpl_dll.h"
int main(int argc, char **arg){
char sText[254];
HELLOIMPL_global_sayHello_2(sText);
printf("Huu Tri %s", sText);
return 0;
}
5. Build the main funciton with winegcc and link to so lib
winegcc -o maintest main.c -L. -lhelloimpl.dll
Build successful BUT when trying to run
./maintest
It show the problem:
wine: could not load L"Z:\\root\\huutri\\maintest.exe.so": Bad EXE format for
More information about the wine-users
mailing list