Linking with DMD

Timon Gehr timon.gehr at gmx.ch
Thu Jun 21 11:09:56 PDT 2012


On 06/21/2012 07:48 PM, Anonymous wrote:
> So I really think improvements could be made on how you link your code
> when compiling it with DMD...
>
> I want to have the complete control over which libraries i link my
> program to...
>
> Actually, i'm not yet planning on using either phobos or tango. (I would
> maybe use one of those when i notice, that one of those libraries offers
> something that i would like to use, because otherwise my executable file
> would unnecessarily blow up in size, right?)
>
> So I ended up downloading the zip-archive of DMD and extracting only the
> parts i need:
>
> - Windows DMD without any lib files (only the contents of the
> \windows\bin\ folder)
> - druntime (object.d, ...)
>
> The folder which was the \windows\bin\ folder is now my main DMD folder
>
> I changed the sc.ini file so that it now only
>
> - looks for lib files in an empty "lib" folder i created inside this
> main DMD folder
> - imports the druntime source files (i exported everything inside
> /src/druntime/src/ into an "import" folder inside the main DMD folder
> and renamed object_.d to object.d)
>
> Now when i try to compile a file with only
> - a module name declaration
> - and an empty void main(){} function (without extern linking)
>
> it says:
>
> OPTLINK : Warning 23: No Stack
> Error 42: Symbol Undefined _main
> Error 42: Symbol Undefined __acrtused_con
> OPTLINK : Warning 134: No Start Address
>
> I would really like seeing this working...
> ...

If linking in the runtime is disabled explicitly, linker errors are to 
be expected.



More information about the Digitalmars-d mailing list