DLL

bsving bsving_member at pathlink.com
Thu May 25 16:25:00 PDT 2006


Hello

I am just looking into this D language mostly just for fun, but seem to be
unable to make a working DLL in D. I try to follow the instructions on the web
side, but with no progress.

I have copied the dll.d (where the dllmain is) and then i have a transform_d.d
file looking like:

import std.math;

export void transform(double *x, double *y, double theta)
{
double c;
double s;
double x_tmp;

x_tmp = *x;
c = cos(theta);
s = sin(theta);
*x = x_tmp*c + *y*s;
*y = *y*c - x_tmp*s;
}


and a .def file looking like
LIBRARY "transform_d.dll"
DESCRIPTION 'DLL written in D'

EXETYPE NT
CODE PRELOAD DISCARDABLE
DATA PRELOAD SINGLE

EXPORTS
transform @2


To compile i use the command:
dmd -oftransform_d.dll transform_d.d dll.d transform_d.def

The compilation seem to go ok, but with the linker (which start automatically) i
get the error message:

OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

OPTLINK : Error 180: No Match Found for Export/ENTRY -  : transform
OPTLINK : Error 81: Cannot EXPORT : transform
--- errorlevel 2


What am i doing wrong?

thanks





More information about the Digitalmars-d mailing list