X86 COFF format static libraries is very important for d,how to use them? -ms32coff?

Rainer Schuetze via Digitalmars-d digitalmars-d at puremagic.com
Mon Nov 10 23:11:23 PST 2014



On 10.11.2014 17:03, FrankLike wrote:
>
>> It's "-m32mscoff", but yeah, that's all you need to use with dmd.
>>  You'll also need to recompile druntime and phobos, which I believe
>> can be done for both with the following command:
>>
>> make -fwin64.mak MODEL=32mscoff
>>
>> win64.mak has the configuration to pull in MSVC and you need to
>> specify the model so that it compiles for 32-bit.  Of course, this is
>> only available in git HEAD, not in the stable release yet.  You can
>> find info about building from source on Windows here:
>>
>> http://wiki.dlang.org/Building_DMD#Windows_2
>
> I've built the 'lib64'  it's ok,
> make -fwin64.mak  for 'druntime and phobos'
> but I've built the
> 'lib32mscoff'(druntime32mscoff.lib,gcstub32mscoff.obj,phobos32mscoff.lib)
>
>   use 'make -fwin64.mak MODEL=32mscoff'
>
> but get some errors:
> this is my bat file info:
>
> set lib=C:\Program Files (x86)\Microsoft Visual Studio
> 10.0\VC\lib;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc
>
> \lib;C:\Program Files (x86)\Microsoft
> SDKs\Windows\v7.0A\Lib;H:\D\dmd2\windows\libms32coff
>
> dmd -c -release -m32mscoff a.d
> link   a.obj  /machine:x86 /OUT:a.exe   druntime32mscoff.lib
> gcstub32mscoff.obj phobos32mscoff.lib
>
> It works on vs2010:   %comspec% /k ""C:\Program Files (x86)\Microsoft
> Visual Studio 10.0\VC\vcvarsall.bat"" x86
>
> It can get the a.obj
>
> dumpbin a.obj ,it's COFF type.
> ---------------------------------------------Err-------------------------------------
>
> Err:
>
>   will create a.lib and a.exp
>   druntime32mscoff.lib(dmain2_560_47b.obj):error LNK2019:Unresolved
> external symbol _getErrno,the  symbol is referenced in __d_run_main
> phobos32mscoff.lib(errno_229_226.obj):error LNK2001:Unresolved external
> symbol _getErrno
> a.exe:fatal error LNK1120:An unresolved external symbol.
>
> -----------------------------------------------------------------
>
> Thank you.

I suspect you are compiling the druntime/phobos library with the 64-bit 
VC compiler. Make sure cl.exe is the compiler targeting 32-bit when 
running "make -fwin64.mak MODEL=m32mscoff".


More information about the Digitalmars-d mailing list