www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - How do you export a Class into a DLL? Plz someone.

reply David L. Davis <SpottedTiger yahoo.com> writes:
I've been spenting a good number of hours reading this, trying that, and I've
finally gotten the small test program to complie and link, but gI et an "Error:
Access Violation" error when I run it.

This is the Test Class in WinDLL.d:




















Here's the .DEF file I used:









#EXPORTS       _Class_6WinDLL4Test  

The _Class_6WinDLL4Test I hand wrote in after dmd and the linker didn't place
this entry in the DLL...not sure if I'm suppose to do it this way. But all three
of methods in the Class all showed up, so the "export" next to them seem to work
just fine.

Then I compiled the WinDLL.dll with the following line:
dmd windll.d windll.def

After downloading ftp://ftp.digitalmars.com/bup.zip, and extracting implib.exe
into "dmd\bin" directory.

I then created the WinDLL.lib with the following line:
implib /system windll.lib windll.dll

Used the following loader.d code below:




















And a final compile loader.exe with the following line:
dmd loader.d windll.d windll.lib

I sure hope someone can tell me what I'm missing, since I've mainly created "C"
EXE and .DLL in the past, I've never had any Classes to export into DLL
before...now it would be great if I could learn how it is done, by a Class Pro!
;) 

Thxs for any help, or pointers in advance!

-------------------------------------------------------------------
"Dare to reach for the Stars...Dare to Dream, Build, and Achieve!"
Jul 19 2004
parent "Carlos Santander B." <carlos8294 msn.com> writes:
"David L. Davis" <SpottedTiger yahoo.com> escribió en el mensaje
news:cdi63b$11t3$1 digitaldaemon.com
| I've been spenting a good number of hours reading this, trying that, and
I've
| finally gotten the small test program to complie and link, but gI et an
"Error:
| Access Violation" error when I run it.
| ...

I think the standard DLL format (or whatever it's called) doesn't allow
that.
I know that currently there's no way to do that with DMD.

-----------------------
Carlos Santander Bernal
Jul 21 2004