From: Luke D. <cod...@ho...> - 2007-04-06 16:22:49
|
----- Original Message ----- From: "Brian Dessent" <br...@de...> To: "MinGW Users List" <min...@li...> Sent: Friday, April 06, 2007 9:08 PM Subject: Re: [Mingw-users] MSVC import library confusion > Chr...@in... wrote: > >> > All interfaces must be 'extern "C"'. >> >> Hm, ok. So will it work when I implement a function like: >> >> extern "C" EXPORT Util *createUtil() { >> return new Util(); >> } >> >> within the library? As I am in contact with the library developers this >> would be possible. Then I could also load the dll dynamically. > > It would only work if the class is POD, and even then it might not due > to differences in packing, alignment, or layout. You really can't mix > C++ among different compilers. > > Brian If the class (Util) uses ONLY the parts of C++ that are standardised by COM then it will work. In other words, if the calling code only accesses virtual member functions (no other member functions or any member variables) then it will work, because the layout of virtual tables is compatible across compilers. Luke |