Linking from source-code

Andrea Fontana nospam at example.com
Thu Nov 14 03:43:30 PST 2013


Is there a way to define a library to link inside d source? I 
can't find anything about it.

IMHO it would very useful for deimos libraries or curl. So when 
you import a library, it has embedded the linking instruction.

For import we write:

import std.stdio;

That means "more or less": look for std/stdio.d inside search 
directories.

Why not then:

import_lib curl;  // or other kw

It should mean link libcurl on linux, curl.dll on windows and so 
on.

Running code with rdmd will not need any extra configuration.
Using version we can link right library (debug/release/etc).

Writing:

dmd hello_world.d -L-lcurl

sounds me like we have to write:
dmd hello_world.d -I"std/stdio.d" -I"std/curl.d" -L-lcurl

To import "headers"


More information about the Digitalmars-d-learn mailing list