charles
charles

Reputation: 547

Could a D DLL work within SAS?

I've been reading the D Cookbook and near the beginning there's the following sentence:

D is binary compatible with C, but not source compatible.

SAS allows users to define and call C functions from within SAS. But I'm wondering, would it'd also be possible to do this from D?

I found Adam Ruppe's answer to create a DLL here, and I tried using that to create the DLL example from the SAS documentation; however, whenever I go to call it, the dll gets loaded, and then SAS proceeds to crash (without any crash log that I can find).

Upvotes: 5

Views: 169

Answers (1)

Vladimir Panteleev
Vladimir Panteleev

Reputation: 25187

Yes, you can write DLLs in D which use or implement a C API.

You have to make sure that the function signatures and calling conventions match. In the page you linked, the calling convention is indicated as stdcall, so your D functions need to be annotated with extern(Windows) or extern(System).

Upvotes: 7

Related Questions