Re: How to link *.a file on Windows?

2016-09-24 Thread Mike Parker via Digitalmars-d

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


Re: How to link *.a file on Windows?

2016-09-23 Thread Basile B. via Digitalmars-d

On Friday, 23 September 2016 at 06:27:20 UTC, Brian wrote:

how to static link libmemcached.lib?


Just pass the filename to the compiler as if it's a ".d" source 
and put the path to the sources root with -I


dmd app.d libmemcached.lib -Ipath/to/memcached/interface/


Re: How to link *.a file on Windows?

2016-09-23 Thread Brian via Digitalmars-d

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?


Re: How to link *.a file on Windows?

2016-09-23 Thread Mike Parker via Digitalmars-d

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?


I don't know of any D compiler that supports Cygwin. There are 
older releases of LDC built on top of MinGW and GDC has had some 
releases for Windows, but I don't believe you'd be able to use 
anything generated by the Cygwin toolchain with those.


Re: How to link *.a file on Windows?

2016-09-22 Thread kinke via Digitalmars-d

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?


You'd probably need to use the GNU linker then, but the D objects 
would need to match the format used for your C++ lib. You could 
give the GDC compiler a shot, or use clang to compile the C++ lib 
to MS COFF format (.lib), which can then be fed to both DMD and 
LDC on Windows.


Re: How to link *.a file on Windows?

2016-09-22 Thread Basile B. via Digitalmars-d

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?


should be a .lib under windows. *.a is an archive of object files 
(aka a static library) for Posix systems. *.lib is the same but 
for Windows.


How to link *.a file on Windows?

2016-09-22 Thread Brian via Digitalmars-d

I use cygwin build a C++ lib file:

libmemcached.a

but, how to link it to my dub project?