user41010
user41010

Reputation: 101

Can a statically linked Linux lib be converted to COFF and be linked by MinGW, to run on a Linux system?

There is a windows application that I have the source to. It compiles under MinGW, links fine against wine, and executes, on a Linux system.

However, I would like it to call into a Linux library.

Since the Linux lib is statically linked, I thought I could convert it to the COFF format, and that it would execute correctly under wine. I could even make some degree of changes to the Linux-lib sources to accommodate this, though truly porting it to win32 would be impossible.

I tried converting it to COFF32 (it is a 32bit lib already, and the windows project is 32bit as well). However, objconv seems to be unable to convert it. Can anyone help me understand the conversion error? (I'm afraid I cannot provide the source code, as it is proprietary.)

~objconv -fCOFF32 -xs _build/Common/libcommon.a bin/common.lib~

~Error 2037: Symbol storage/binding type 10 not supported~

Edit: I have gotten the object to convert. However, wine now fails to load the executable. :(

gcc -o "${CommonObj}" -m32 -march=i386 -g0 ${Opts_Cmmn[@]}

i686-w64-mingw32-objcopy -O pe-i386 -S "./${CommonObj}" "${LibOut}"

I notice that objcopy outputs this warning:

->output.exe:.comment: section below image base

Wine then fails to load the executable:

-> Application could not be started, or no application associated with the specified file.

-> ShellExecuteEx failed: Bad EXE format for ./output.exe

Upvotes: 0

Views: 159

Answers (0)

Related Questions