Yes, you can say it's an ABI issue. There are generally no C++ ABI
provisions for inter-compiler (complex) object passing. You have only
moderate access to influence name mangling (via extern "C" { } constructs)
and calling convention (stdcall and friends), but inheritance has other
requirements (VTables, thunks, etc.), which aren't exactly formalized in a
compiler-way. You must use regular (non-virtual) function pointers and POD
objects if you want C++ compilers from different vendors (and sometimes,
different versions of the same compiler, for that matter) to cooperate
portably.On Wed, Jun 17, 2015 at 12:44 PM, Etienne Sandré-Chardonnal < [email protected]> wrote: > Dear all, > > I have a plugin system in my app based on interfaces (classes with only > pure virtual functions). The app is compiled with mingw-w64 4.9.2 and works > well with plugin dlls compiled with the same compiler. > > Now I am trying to support MSVC compiled plugins. > > This works partially : the app can call the methods from interface objects > provided by the DLL. However, if I pass a pointer on an interface class to > one of the DLL methods, it does a segmentation fault. > > After debugging, I have seen this: > > *A is a pointer to an object deriving from InterfaceA , and created by the > app. > *B is a pointer to an object deriving from InterfaceB, and created by the > dll > > From the app, I call B->someMethod(A); > and someMethod calls A->someOtherMethod() > > When I debug inside someOtherMethod (which is an app side method), "this" > should point on *A, but it points on *B. Which causes the segmentation > fault afterwards. > > Can this be an ABI issue? > > Thanks! > > > > > ------------------------------------------------------------------------------ > > _______________________________________________ > Mingw-w64-public mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public > >
------------------------------------------------------------------------------
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
