Hello list!

first of all: Thanks for providing MingW and this list which archive already helped me a lot solving some Mingw related problems. Now a fell into one that I can not solve without help and I hope someone of you got into the same:

I use Mingw-w64 distributed with OpenSuse Linux 12.2 64 Bit (based on Gcc 4.7.2). I need to call a function from a (static!) third-party library which was compiled using VC++ 9.0 (VS2008) targeting amd64, file name: the_third_party_lib.lib.     the_third_party_lib.lib is pure C - hence it should be binary compatible with GCC. 

Now I have an interesting situation: 

Linking with standard options gives me:
> undefined reference to `__sys_nerr'
> undefined reference to `__sys_errlist'

I can resolve this by changing the spec file, i.e.
gcc -dumpspecs > spec90
vi spec90
Replace all links to msvcrt by msvcr90
Unfortunately, openSuse's Mingw does not come with moldname90, hence I use moldname in the changed specs. 

Adding -specs=spec90 to the command line, GCC links fine: 
> gcc -v  -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 --param=ssp-buffer-size=4 -mms-bitfields -fno-keep-inline-dllexport -fpermissive -fexceptions -frtti main.c -lthe_third_party_lib  -lruntmchk -lole32 -loleaut32 -lWbemUuid -lws2_32 -lcomctl32 -lcomdlg32 -lnetapi32 -mwindows -specs=spec90

The libraries runtmchk and WbemUuid are from the VS2008 and are needed by the_third_party_lib. 

The link command (excerpted from gcc -v) is:
> collect2 -m i386pep --subsystem windows -Bdynamic lib/crt2.o lib/crtbegin.o -L. -Llib tmp.o -lthe_other_lib -lruntmchk -lole32 -loleaut32 -lWbemUuid -lws2_32 -lcomctl32 -lcomdlg32 -lnetapi32 -lmingwthrd -lmingw32 -lgcc_eh -lgcc -lmoldname -lmingwex -lmsvcr90 -lgdi32 -lcomdlg32 -ladvapi32 -lshell32 -luser32 -lkernel32  lib/crtend.o
Hence it really takes the modified specs and overrides msvcrt. 

Running the executable using latest WINE on Linux also works fine: There is no segfault and I can call the API of the_third_party_lib without errors. 

On Windows 7, however, I get the error
"R6034 An application has made the attempt to load the C runtime incorrectly"

I also put a manifest file next to my executable a.exe:
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
        <requestedExecutionLevel level='asInvoker' uiAccess='false' />
      <assemblyIdentity type='win32' name='Microsoft.VC90.CRT' version='9.0.21022.8' processorArchitecture='amd64' publicKeyToken='1fc8b3b9a1e18e3b' />

and I still get the same error on Windows7.   There were some rumors in the WWW hinting that a mistake in the manifest could be the problem. Hence I built the same executable with VC++ and copied its manifest to be safe.  

The software Dependency Walker also lists some references to msvcrt.dll (!?) I wonder how this comes, maybe from the native msvcrt90.dll? 

However, I am at the end with my ideas in fixing this problem. I checked out some recent posts:
But it seems that they solved their issues. Any suggestions are warmly welcome!

Best regards