uzul
uzul

Reputation: 1136

How to compile a msvc static library to be linked from DMD?

I've been spending a lot of time trying to build D bindings for an open source C library.

I'm using msvc to build the C a static .lib, but DMD is unable to recognize the .lib file, it seems to be a problem related to the COFF/OMF incompatibilities.

What is the easiest way to compile a C library, OMF compatible, to be linked from D?

Upvotes: 2

Views: 152

Answers (1)

ratchet freak
ratchet freak

Reputation: 48196

Port the header file into a .di file with matching function signatures and extern (C). Then use that as the import target. You can use the htod tool to help with that.

See http://dlang.org/spec/interfaceToC.html

Upvotes: 1

Related Questions