www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - dlls

reply "aelmetwaly" <aelmetwaly gawab.com> writes:
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?
Oct 18 2004
parent reply John Reimer <brk_6502 NOSP_AM.yahoo.com> writes:
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?
 
 
by returning a class object pointer using one of your exported dll functions. 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.
Oct 18 2004
parent reply teqDruid <me teqdruid.com> writes:
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?
 
 
by returning a class object pointer using one of your exported dll functions. 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
Oct 18 2004
parent John Reimer <brk_6502 NOSP_AM.yahoo.com> writes:
teqDruid wrote:


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.
Oct 18 2004