wine: could not load and Bad EXE format for

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
huutri
Newbie
Newbie
Posts: 3
Joined: Sun Dec 14, 2008 10:26 pm

wine: could not load and Bad EXE format for

Post by huutri »

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: Select all

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@Z' ... [OK]
Export   2 - '?sayHello@@YAXPAD@Z' ... [OK]
Export   3 - '?writeNUM@@YAXH@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 
dungeon
Newbie
Newbie
Posts: 1
Joined: Thu Jun 17, 2010 4:19 pm

Try to scan the exe with PEiD

Post by dungeon »

Maybe the exe is defective. Try to scan it with PEiD (run it with wine):

http://www.peid.info/
Locked