Thread overview
dlls
Oct 18, 2004
aelmetwaly
Oct 18, 2004
John Reimer
Oct 18, 2004
teqDruid
Oct 18, 2004
John Reimer
October 18, 2004
I once asked this question earlier but I didn't get any responce so I'll
echo it here:
       = How to export a class in a dll ?

       = To hide the implementation, we use a file containing the
declaration of the
            exported symbols. Is this a header file with .d extension?
couldn't the D
            compiler emit a file with these exports during compiling, which
can be used
            as an import with dll clients?


October 18, 2004
aelmetwaly wrote:
> I once asked this question earlier but I didn't get any responce so I'll
> echo it here:
>        = How to export a class in a dll ?
> 
>        = To hide the implementation, we use a file containing the
> declaration of the
>             exported symbols. Is this a header file with .d extension?
> couldn't the D
>             compiler emit a file with these exports during compiling, which
> can be used
>             as an import with dll clients?
> 
> 

Question #1: I'm not sure about this one.  It's probably done manually by returning a class object pointer using one of your exported dll functions.

Question #2: Basically, yes.  See http://www.digitalmars.com/d/windows.html

And, yes, the compiler could be programmed to emit such a file.  But, as I understand it, doing such would constitute a fancy feature.  Fancy features such as that aren't currently a priority.  Bug fixes are.
October 18, 2004
On Mon, 18 Oct 2004 09:21:14 -0700, John Reimer wrote:

> aelmetwaly wrote:
>> I once asked this question earlier but I didn't get any responce so I'll
>> echo it here:
>>        = How to export a class in a dll ?
>> 
>>        = To hide the implementation, we use a file containing the
>> declaration of the
>>             exported symbols. Is this a header file with .d extension?
>> couldn't the D
>>             compiler emit a file with these exports during compiling, which
>> can be used
>>             as an import with dll clients?
>> 
>> 
> 
> Question #1: I'm not sure about this one.  It's probably done manually by returning a class object pointer using one of your exported dll functions.
> 
> Question #2: Basically, yes.  See http://www.digitalmars.com/d/windows.html
> 
> And, yes, the compiler could be programmed to emit such a file.  But, as I understand it, doing such would constitute a fancy feature.  Fancy features such as that aren't currently a priority.  Bug fixes are.

As I understand it, the reason it's not there is not that it's a fancy feature, but that it's not something a compiler should be doing.  A compiler should only be compiling. DMD is meant to be used as a small tool in a larger collection.  Whatever program you're using to invoke DMD should do it.  dmake and/or some component of dig might do this, but I haven't played with either of them

John
October 18, 2004
teqDruid wrote:
>>Question #2: Basically, yes.  See http://www.digitalmars.com/d/windows.html
>>
>>And, yes, the compiler could be programmed to emit such a file.  But, as I understand it, doing such would constitute a fancy feature.  Fancy features such as that aren't currently a priority.  Bug fixes are.
> 
> 
> As I understand it, the reason it's not there is not that it's a fancy
> feature, but that it's not something a compiler should be doing.  A
> compiler should only be compiling. DMD is meant to be used as a small tool
> in a larger collection.  Whatever program you're using to invoke DMD
> should do it.  dmake and/or some component of dig might do this, but I
> haven't played with either of them
> 
> John

Well, yes, I forgot to mention the availability of tools such as digc and dmake that function as compiler aids (albeit for slightly different purposes).  But, my point was, some people like features like this in the compiler, much like the ability to generate map files, ouput disassembly, or combine the compile and link steps into one.  Such things might constitute "fancy" as well.  I guess the compiler designer decides what features should be relegated to external tools.  Personally , I'd find a stripping feature a useful part of the compiler output. But yes, it can be done just as effectively by an external tool.