D Dll's usefulness

Igor via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 25 11:45:21 PST 2016


Can D Dll's be linked and used as if they were compiled directly 
with the program? I was thinking of writing some library routines 
and put them in a Dll but now I'm not thinking that would be very 
useful because the Dll's won't export class like behavior.

in my DLL:

class MyClass { void foo() { } }

in my app:

auto c = new MyClass();

I'd like to use MyClass as if it were defined directly here, but 
I think I can only load the dll and attach to foo? Is this right?

Since I'm the "owner" of the library I can always just "drag and 
drop" the source code into the project to get the desired 
behavior. I'd like the DLL to provide that to future projects 
that may not have the source code. Either the DLL's don't support 
this, which I think is the case, or I have to include a "header".

Hopefully there is a tool that could take a "library" that will 
be used as a dll and strip it down into modules that can be 
included into the main app so it can be used as if the source 
code was directly compiled in.

Am I off target here?










More information about the Digitalmars-d-learn mailing list