DLL

Sjoerd van Leent svanleent at gmail.com
Thu May 25 23:02:41 PDT 2006


bsving schreef:
> In article <e55f2s$rr7$1 at digitaldaemon.com>, Kirk McDonald says...
>> Try declaring transform as extern (C), i.e.:
>>
>> export extern (C)
>> void transform(double *x, double *y, double theta) {
>>     // ...
>> }
>>
>> -Kirk McDonald
> 
> WOW, thanks. it works like a charm. Just for the fun of it I was investigating
> if it was possible to write D DLLs to be used in LabVIEW, and yes it works. But
> why do i need this extern (C)? the web site at Digitalmars says nothing about
> that.
> 
> 

Hello Kirk,

D normally mangles the names, into quite difficult to read object-file 
labels. So that you are able to do overloading, and having the same name 
in different modules. So this becomes possible:

module test1;

void transform(double *x);

module test2;

void transform(int[] y);
void transform(int[] y, int[] z);


Using the extern(C) directive eliminates the name mangling, making the 
object-file label looking like:

_transform

just as it would be in C

Regards,
Sjoerd



More information about the Digitalmars-d mailing list