Linking C libraries with DMD
jmh530 via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jan 21 18:02:43 PST 2016
On Friday, 22 January 2016 at 00:43:05 UTC, W.J. wrote:
>
> The GNU linker ld, for instance, uses the -l<libname> switch
> for adding libraries to link against and -L<path> to add a
> search path to look for the libraries passed in with
> -l<libname>.
>
> If you leave it to the compiler to invoke the linker you need
> to remember the -L compiler switch is passing what follows to
> the linker (minus the -L compiler switch).
> I.e. -L-LC:\lib\path will be passed on as "-LC:\lib\path",
> -L-lsomelib => "-lsomelib", etc.
The -L-L stuff from the LearningD book is making more sense. The
book is using Linux examples, linux uses ld, which has those
flags.
>> LNK1136 is for a corrupt or abnormally small file. I did
>> notice that the original dll was 82kb and the lib file was 2kb.
>
> The lib for a 'DLL' is small because it just tells the linker
> where to find the code in the 'DLL' - the actual code is in the
> 'DLL'.
>
> Hope the helps
That's clear. Thanks.
More information about the Digitalmars-d-learn
mailing list