www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Exporting classes and interfaces from DLL

reply Yossarian <xtauer01 stud.fit.vutbr.cz> writes:
Hi, I've got following problem:
I have interface, with some defined functions, + some another classes  
derived from it in EXE ( kind of Variant type ).

class iObject { }
class integerConst : iObject { }
class stringConst : iObject { }
final export T as(T)(iObject n) { if (cast(T)(n) == null) throw new  
exception; return (cast(T)(n)); }

I want to make plugin interface - and to export these classes to it. When  
i statically link the DLL code with
my interface code, the DLL's string isn't the same as EXE's string.
(Another problem is, that the exception thrown from DLL isn't catched in  
EXE, but falls through and program crashes, but never mind)

So, I moved all of the interface code into new DLL, and link my plugina  
and EXE against it.
And there comes the problem :

export class integerConst : iObject { } -> doesn't export anything.
When I export all of the (public) function, there still remains some  
other, which are hidden,
is there any way how to export them, or with these classes I should say  
goodbye to plugins?


error:
..\debug\gx.obj(gx)
  Error 42: Symbol Undefined _D4ghhd7iobject7iObject7__ClassZ
..\debug\gx.obj(gx)
  Error 42: Symbol Undefined _D4ghhd7iobject8__assertFiZv
..\debug\gx.obj(gx)
  Error 42: Symbol Undefined _D4ghhd7iobject7__arrayZ
..\debug\gx.obj(gx)
  Error 42: Symbol Undefined _D4ghhd12integerConst12integerConst7__ClassZ

_D4ghhd12integerConst12integerConst7__ClassZ
_D4ghhd7iobject7iObject7__ClassZ
are maybe for comparing/casting, and I can avoid it with some ugly method,  
but this isn't what i want.

Thanks, and sorry for my bad english
-- Yossarian
Tato zpráva byla vytvořena převratným poštovním klientem Opery:  
http://www.opera.com/mail/
May 13 2008
next sibling parent Yossarian <xtauer01 stud.fit.vutbr.cz> writes:
According to documentation, I inserted it as a new bug.


Dne Wed, 14 May 2008 01:08:35 +0200 Yossarian <xtauer01 stud.fit.vutbr.cz>  
napsal/-a:

 Hi, I've got following problem:
 I have interface, with some defined functions, + some another classes  
 derived from it in EXE ( kind of Variant type ).

 class iObject { }
 class integerConst : iObject { }
 class stringConst : iObject { }
 final export T as(T)(iObject n) { if (cast(T)(n) == null) throw new  
 exception; return (cast(T)(n)); }

 I want to make plugin interface - and to export these classes to it.  
 When i statically link the DLL code with
 my interface code, the DLL's string isn't the same as EXE's string.
 (Another problem is, that the exception thrown from DLL isn't catched in  
 EXE, but falls through and program crashes, but never mind)

 So, I moved all of the interface code into new DLL, and link my plugina  
 and EXE against it.
 And there comes the problem :

 export class integerConst : iObject { } -> doesn't export anything.
 When I export all of the (public) function, there still remains some  
 other, which are hidden,
 is there any way how to export them, or with these classes I should say  
 goodbye to plugins?


 error:
 ..\debug\gx.obj(gx)
   Error 42: Symbol Undefined _D4ghhd7iobject7iObject7__ClassZ
 ..\debug\gx.obj(gx)
   Error 42: Symbol Undefined _D4ghhd7iobject8__assertFiZv
 ..\debug\gx.obj(gx)
   Error 42: Symbol Undefined _D4ghhd7iobject7__arrayZ
 ..\debug\gx.obj(gx)
   Error 42: Symbol Undefined _D4ghhd12integerConst12integerConst7__ClassZ

 _D4ghhd12integerConst12integerConst7__ClassZ
 _D4ghhd7iobject7iObject7__ClassZ
 are maybe for comparing/casting, and I can avoid it with some ugly  
 method, but this isn't what i want.

 Thanks, and sorry for my bad english
 -- Yossarian
 Tato zpráva byla vytvořena převratným poštovním klientem Opery:  
 http://www.opera.com/mail/
-- Tato zpráva byla vytvořena převratným poštovním klientem Opery: http://www.opera.com/mail/
May 14 2008
prev sibling parent reply Pragma <eric.t.anderton gmail.com> writes:
Yossarian Wrote:

 Hi, I've got following problem:
 I have interface, with some defined functions, + some another classes  
 derived from it in EXE ( kind of Variant type ).
 
 class iObject { }
 class integerConst : iObject { }
 class stringConst : iObject { }
 final export T as(T)(iObject n) { if (cast(T)(n) == null) throw new  
 exception; return (cast(T)(n)); }
 
 I want to make plugin interface - and to export these classes to it. When  
 i statically link the DLL code with
 my interface code, the DLL's string isn't the same as EXE's string.
 (Another problem is, that the exception thrown from DLL isn't catched in  
 EXE, but falls through and program crashes, but never mind)
 
 So, I moved all of the interface code into new DLL, and link my plugina  
 and EXE against it.
 And there comes the problem :
 
 export class integerConst : iObject { } -> doesn't export anything.
 When I export all of the (public) function, there still remains some  
 other, which are hidden,
 is there any way how to export them, or with these classes I should say  
 goodbye to plugins?
I prepared this a long time ago, but it should still be relevant: http://www.wikiservice.at/wiki4d/wiki.cgi?BestPractices/DLL Does this help you with your problem, or at least explain what's wrong? - Pragma
May 14 2008
parent Yossarian <xtauer01 stud.fit.vutbr.cz> writes:
Dne Wed, 14 May 2008 16:40:02 +0200 Pragma <eric.t.anderton gmail.com>  
napsal/-a:

 Yossarian Wrote:

 Hi, I've got following problem:
 I have interface, with some defined functions, + some another classes
 derived from it in EXE ( kind of Variant type ).

 class iObject { }
 class integerConst : iObject { }
 class stringConst : iObject { }
 final export T as(T)(iObject n) { if (cast(T)(n) == null) throw new
 exception; return (cast(T)(n)); }

 I want to make plugin interface - and to export these classes to it.  
 When
 i statically link the DLL code with
 my interface code, the DLL's string isn't the same as EXE's string.
 (Another problem is, that the exception thrown from DLL isn't catched in
 EXE, but falls through and program crashes, but never mind)

 So, I moved all of the interface code into new DLL, and link my plugina
 and EXE against it.
 And there comes the problem :

 export class integerConst : iObject { } -> doesn't export anything.
 When I export all of the (public) function, there still remains some
 other, which are hidden,
 is there any way how to export them, or with these classes I should say
 goodbye to plugins?
I prepared this a long time ago, but it should still be relevant: http://www.wikiservice.at/wiki4d/wiki.cgi?BestPractices/DLL Does this help you with your problem, or at least explain what's wrong?
In fact, it only confirmed me, where the problem is. I think, that when i export the whole class : export class C { } it should export also type information and constructors (ie. default constructor) as well (according to documentation), and other classes / whatever depending on the library should import type information from it.
 - Pragma
-- Yossarian Tato zpráva byla vytvořena převratným poštovním klientem Opery: http://www.opera.com/mail/
May 14 2008