Using C library libsndfile with D

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jun 25 11:29:22 PDT 2015


On 06/25/2015 11:12 AM, kerdemdemir wrote:

 > I downloaded the project from.
 > https://github.com/D-Programming-Deimos/libsndfile
 >
 > I add the sndfile.di file to my project.
 >
 > I thought I could directly use  libsndfile.dll since D directly supports
 > C. But I am getting link errors.

Bindings are for compilation only. You still need to link with the 
libraries, which varies by platform.

D has the pragma(lib) feature where you can tell the compiler to link 
with a specific library as well. For example:

   pragma(lib, "curl");

You would probably use "sndfile" in your case (not sure):

   pragma(lib, "sndfile");

 > Can I use a C DLL directly ?

Yes.

 > Do I have to add anything to my dub.json file if dll is my project file ?

I will let others answer that. I don't know Windows anymore.

 > What is "Deimos" stands for ?

All the names come from planet Mars. Phobos is its large moon and Deimos 
is the small one.

 > Is it collections of bindings ?

Yes.

 > Does community supports "Deimos" projects?

Yes.

Ali



More information about the Digitalmars-d-learn mailing list