   C++ Interface Exposure via DllExport
  Hello, I'm currently working on an extension loading system for one of my tools, and I want the extensions to be able to call an export to get an 'interface' pointer which they can use to access the API.Basically I'm attempting to implement it similar to how D3D etc is implemented.The problem is, I can't seem to expose my interface without exporting all the classes I want to allow extension developers to use. This adds a LOT of exports to my module (fully qualified C++ style exports).How does D3D get away with a C-style export and a C++ style class interface? Is it because it 'strips' the C++ features that would typically require C++ style exporting? Because I've noticed all of its class member functions are actually __stdcall rather than __thiscall, and 'this' is just passed on the stack as the first param.Even then though, how does that allow them to expose their interface without having to expose all the public methods for their class?Thanks.P.S. If it matters the interface makes heavy use of singletons.   
  For my project i exposed interface classes, the C interface on the DLL returns interface pointers to derrived classes. The DLL itself has a CreateMyDLLInterface() whcih has methods on it to create you other things.   ;Quote:Original post by CypherjbThe problem is, I can't seem to expose my interface without exporting all the classes I want to allow extension developers to use.I'm trying to figure out why you think that a DLL should expose a class without exporting it or even what that means in the first place. The idea seems to be fundamentally contradictory.;  Just export the abstract interfaces where all the methods of the class are pure virtual.Then export factory functions which return pointers to the interfaces(base classes)which are actually classes derived from the interface class with an actual implementation.Use factory functions such as Create..., CreateFrom..., Load..., LoadFrom..., just like Directx does.Edit: Sorry I didn't see Dave's post, basically what he said :)[Edited by - Cambo_frog on June 28, 2009 11:19:40 AM];Quote:Original post by DaveFor my project i exposed interface classes, the C interface on the DLL returns interface pointers to derrived classes. The DLL itself has a CreateMyDLLInterface() whcih has methods on it to create you other things.Bingo that's what I was missing. Thanks.Quote:Original post by SiCraneQuote:Original post by CypherjbThe problem is, I can't seem to expose my interface without exporting all the classes I want to allow extension developers to use.I'm trying to figure out why you think that a DLL should expose a class without exporting it or even what that means in the first place. The idea seems to be fundamentally contradictory.Sorry if I was unclear. I don't want to export all the public methods of the class as full C++ decorated exports. D3D for example simply exports IDirect3D9Create (as a C-style export) and doesn't have to export its entire class. So does another tool which I checked. I'm assuming this is allowed because the declarations in the SDK are pure virtual.   