Re: Making plugin system with shared libraries. Upcast in shared lib

2014-10-22 Thread Kagamin via Digitalmars-d-learn
The idea is that the object you work with is responsible for casting itself to an interface you need.

Re: Making plugin system with shared libraries. Upcast in shared lib

2014-10-22 Thread Kagamin via Digitalmars-d-learn
It's how COM casts objects http://msdn.microsoft.com/en-us/library/ms687230.aspx

Re: Making plugin system with shared libraries. Upcast in shared lib

2014-10-21 Thread Kagamin via Digitalmars-d-learn
On Monday, 20 October 2014 at 15:07:43 UTC, MrSmith wrote: On Monday, 20 October 2014 at 14:05:29 UTC, Kagamin wrote: Do it the COM way: publish IModule2 interface and declare GetInterface method, which will return a prepared pointer, which you would reinterpret cast to IModule2. Will it

Re: Making plugin system with shared libraries. Upcast in shared lib

2014-10-21 Thread MrSmith via Digitalmars-d-learn
On Tuesday, 21 October 2014 at 13:57:23 UTC, Kagamin wrote: On Monday, 20 October 2014 at 15:07:43 UTC, MrSmith wrote: On Monday, 20 October 2014 at 14:05:29 UTC, Kagamin wrote: Do it the COM way: publish IModule2 interface and declare GetInterface method, which will return a prepared pointer,

Re: Making plugin system with shared libraries. Upcast in shared lib

2014-10-20 Thread Kagamin via Digitalmars-d-learn
Do it the COM way: publish IModule2 interface and declare GetInterface method, which will return a prepared pointer, which you would reinterpret cast to IModule2.

Re: Making plugin system with shared libraries. Upcast in shared lib

2014-10-20 Thread MrSmith via Digitalmars-d-learn
On Monday, 20 October 2014 at 14:05:29 UTC, Kagamin wrote: Do it the COM way: publish IModule2 interface and declare GetInterface method, which will return a prepared pointer, which you would reinterpret cast to IModule2. Will it work on linux with simple .so libs? I want it to be as simple

Re: Making plugin system with shared libraries. Upcast in shared lib

2014-10-20 Thread Martin Nowak via Digitalmars-d-learn
On 10/20/2014 12:32 AM, MrSmith wrote: Than any module can search for registered modules and try to cast them to concrete type (upcast). That can't work because the notion of types only exists during compilation. Therefor it's not possible to load new types at runtime and use them in code

Re: Making plugin system with shared libraries. Upcast in shared lib

2014-10-20 Thread MrSmith via Digitalmars-d-learn
On Monday, 20 October 2014 at 15:30:28 UTC, Martin Nowak wrote: On 10/20/2014 12:32 AM, MrSmith wrote: Than any module can search for registered modules and try to cast them to concrete type (upcast). That can't work because the notion of types only exists during compilation. Therefor it's

Making plugin system with shared libraries. Upcast in shared lib

2014-10-19 Thread MrSmith via Digitalmars-d-learn
I'm using Windows. I was making some sort of modular system where you can define modules that are loaded by host application. Here is a simple example https://gist.github.com/MrSmith33/7692328455a19e820a7c Now i want to separate these modules in separate shared libs and link them on the fly.