How to link *.a file on Windows?

Mike Parker via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 23 23:12:58 PDT 2016


On Friday, 23 September 2016 at 06:27:20 UTC, Brian wrote:
> On Thursday, 22 September 2016 at 17:09:38 UTC, Brian wrote:
>> I use cygwin build a C++ lib file:
>>
>> libmemcached.a
>>
>> but, how to link it to my dub project?
>
> My plan:
> 1.I use cygwin build libmemcached.dll
> 2.use def tools export libmemcached.def
> 3.use VS2015 dev tools convert libmemcached.dll to 
> libmemcached.lib
> 4.use coffimplib convert libmemcached.lib for D compiler
>
> but, this plan must dep dll file.
>
> how to static link libmemcached.lib?

With dub, you can use the the 'libs' directive in your 
configuration file. See the Build Settings section a [1] if you 
are using JSON and [2] for SDL. If you manage to get your 
Cygwin-compiled libs to work with DMD successfully with this 
approach, please let us know. I was unable to get anything more 
than simple C libraries compiled by MinGW to work with DMD.

[1] https://code.dlang.org/package-format?lang=json#build-settings
[2] https://code.dlang.org/package-format?lang=sdl#build-settings


More information about the Digitalmars-d mailing list