Linux dll struct class etc

FreeSlave freeslave93 at gmail.com
Tue Jan 28 04:16:56 PST 2014


On Tuesday, 28 January 2014 at 02:40:40 UTC, Mineko wrote:
> I can't remember whether or not I've asked this.. But either 
> way, is it possible to "export" a class or a struct or 
> something like you do with a windows dll with a linux shared 
> library (dll)?

Do you mean loading classes and structs at runtime? You can do 
this just like in C++ - both library and application should know 
common base type. Then you need to resolve factory function from 
library. Factory function may create some derived class instance 
and return it as base, which known to application. But I'm not 
sure about GC - you will end up with two garbage collectors, as I 
presume. This solution also is only for classes, since structs 
don't support inheritance. Loading structs is more complicated 
and needs some reflection by hand, but still possible.


More information about the Digitalmars-d-learn mailing list