Jump to page: 1 2
Thread overview
VC linker - unresolved external symbols - runtime
Nov 09, 2013
deed
Nov 09, 2013
evilrat
Nov 09, 2013
deed
Nov 09, 2013
deed
Nov 09, 2013
evilrat
Nov 09, 2013
deed
Nov 09, 2013
evilrat
Jan 05, 2014
Palmic
Jan 05, 2014
Palmic
Jan 05, 2014
Erik van Velzen
Jan 05, 2014
Erik van Velzen
Jan 05, 2014
FreeSlave
Jan 05, 2014
Erik van Velzen
Jan 05, 2014
FreeSlave
November 09, 2013
sc.ini
--------------------
[Environment]
DFLAGS="-I%@P%\..\..\src\phobos" "-I%@P%\..\..\src\druntime\import"
VCINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC
WindowsSdkDir=C:\Program Files\Microsoft SDKs\Windows\v7.1
LIB="%@P%\..\lib"

[Environment32]
LIB="%@P%\..\lib"
LINKCMD=%@P%\link.exe

[Environment64]
LIB="%@P%\..\lib64";%WindowsSdkDir%\lib\x64
DFLAGS=%DFLAGS% -L/OPT:NOICF
LINKCMD=%VCINSTALLDIR%\bin\amd64\link.exe
VC2010 LINKCMD=%VCINSTALLDIR%\bin\amd64\link.exe
LIB=%LIB%;"%VCINSTALLDIR%\lib\amd64"
LIB=%LIB%;"%WindowsSdkDir%\Lib\win8\um\x64"
LIB=%LIB%;"%WindowsSdkDir%\Lib\x64"
-------------------


build
-------------------
-ofprog.exe
-m64

-L-subsystem:windows

./src/main.d
user32.lib
-------------------


main.d
-------------------
...
int WintMain(...)
{
    ...
    try
    {
        Runtime.initialize();
        ...
        Runtime.terminate();
    }
    ...
}
--------------------

$ dmd @build
error LNK2019: unresolved external symbol _D4core7runtime7runtime10initializeFZb referenced in function WinMain
error LNK2019: unresolved external symbol _D4core7runtime7Runtime9terminateFZb referenced in function WinMain

core.runtime's import path is specified in the sc.ini file, in DFLAGS
If I specify the core.runtime file in the build file everything works

Why is it so?
November 09, 2013
On Saturday, 9 November 2013 at 15:30:55 UTC, deed wrote:
> core.runtime's import path is specified in the sc.ini file, in DFLAGS
> If I specify the core.runtime file in the build file everything works
>
> Why is it so?

in short - it looks like phobos.lib not linked, try link it manually. i don't know why...
November 09, 2013
On Saturday, 9 November 2013 at 15:49:40 UTC, evilrat wrote:
> On Saturday, 9 November 2013 at 15:30:55 UTC, deed wrote:
>> core.runtime's import path is specified in the sc.ini file, in DFLAGS
>> If I specify the core.runtime file in the build file everything works
>>
>> Why is it so?
>
> in short - it looks like phobos.lib not linked, try link it manually. i don't know why...

No, it doesn't work. Do I have to compile my own runtime library and pass it on the command line? (Have just grabbed the 3.064.2.zip file and not run any installer.)
November 09, 2013
On Saturday, 9 November 2013 at 15:56:12 UTC, deed wrote:
> On Saturday, 9 November 2013 at 15:49:40 UTC, evilrat wrote:
>> On Saturday, 9 November 2013 at 15:30:55 UTC, deed wrote:
>>> core.runtime's import path is specified in the sc.ini file, in DFLAGS
>>> If I specify the core.runtime file in the build file everything works
>>>
>>> Why is it so?
>>
>> in short - it looks like phobos.lib not linked, try link it manually. i don't know why...
>
> No, it doesn't work. Do I have to compile my own runtime library and pass it on the command line? (Have just grabbed the 3.064.2.zip file and not run any installer.)

The readme file in the runtime directory says it's compiled into phobos64.lib, which I presume is passed successfully, otherwise there would have been more unresolved symbols..
November 09, 2013
On Saturday, 9 November 2013 at 15:59:02 UTC, deed wrote:
>>
>> No, it doesn't work. Do I have to compile my own runtime library and pass it on the command line? (Have just grabbed the 3.064.2.zip file and not run any installer.)
>
> The readme file in the runtime directory says it's compiled into phobos64.lib, which I presume is passed successfully, otherwise there would have been more unresolved symbols..

better use installer, or you can try to set correct linker, mspdb dll, and lib paths in sc.ini for your visual c++ and windows sdk.
November 09, 2013
On Saturday, 9 November 2013 at 16:08:15 UTC, evilrat wrote:
> On Saturday, 9 November 2013 at 15:59:02 UTC, deed wrote:
>>>
>>> No, it doesn't work. Do I have to compile my own runtime library and pass it on the command line? (Have just grabbed the 3.064.2.zip file and not run any installer.)
>>
>> The readme file in the runtime directory says it's compiled into phobos64.lib, which I presume is passed successfully, otherwise there would have been more unresolved symbols..
>
> better use installer, or you can try to set correct linker, mspdb dll, and lib paths in sc.ini for your visual c++ and windows sdk.

phobos64.lib contains
_D4core7runtime7Runtime10initializeFDFC6object9ThrowableZvZb
but not
_D4core7runtime7Runtime10initializeFZb

Does this mean that the phobos64.lib is not aligned with current core.runtime module?
November 09, 2013
On Saturday, 9 November 2013 at 16:22:07 UTC, deed wrote:
> phobos64.lib contains
> _D4core7runtime7Runtime10initializeFDFC6object9ThrowableZvZb
> but not
> _D4core7runtime7Runtime10initializeFZb
>
> Does this mean that the phobos64.lib is not aligned with current core.runtime module?

i also have this problem on win 8.1 with visual studio 2013.

smells like a bug for me. file a bug on tracker.

for now i think manually calling rt_init() and rt_term() can be used to avoid it.
January 05, 2014
Same problem here.

Configuration: Windows 8.1, with 8.1 SDK, and visual studio 2013.

I tried to link manually phobos64 with no success. Anyway there is the windows page saying that WinMain automatically forces the compiler to link phobos.

What is even more strange is that if you take

Has a bug report been filled? Or any news regarding this issue?

By the way I'm using VisualD, going to check now if I get the same problem with command line.

On Saturday, 9 November 2013 at 16:46:36 UTC, evilrat wrote:
> On Saturday, 9 November 2013 at 16:22:07 UTC, deed wrote:
>> phobos64.lib contains
>> _D4core7runtime7Runtime10initializeFDFC6object9ThrowableZvZb
>> but not
>> _D4core7runtime7Runtime10initializeFZb
>>
>> Does this mean that the phobos64.lib is not aligned with current core.runtime module?
>
> i also have this problem on win 8.1 with visual studio 2013.
>
> smells like a bug for me. file a bug on tracker.
>
> for now i think manually calling rt_init() and rt_term() can be used to avoid it.

January 05, 2014
Replying to myself:

In my case at lease, I don't think it's a bug...

I have just used the build tool binary that comes with the DWinProgramming samples, added a new folder with my source in the Samples directory, and the tool managed to build it properly...

I will now look at the souces of this build tool, seems like it's not using the same parameters/environment than my VisualD project.
January 05, 2014
It works if you recompile phobos64.lib

So it seems the standard DMD 2.064.2 download comes with an
outdated version of phobos64.lib which is out of sync with the
included source code.
« First   ‹ Prev
1 2