21.07.2014 16:32, Alex Peshkoff wrote: > First of all - formal definition of API is certainly not a set of C++ > classes. Each firebird interface is a single pointer, pointing to the > table of virtual functions that are contained in this interface. First > parameter of each function is always a pointer to an interface itself. > > This definition in plain english may be rewritten in C: > struct ISample > { > struct VTable > { > void functionOne(ISample* this, Type1 par1, Type2 par2, /* > other parameters */); > void functionTwo(ISample* this, TypeA parA, TypeB parB, /* > other parameters */); > /* other functions ... */ > }; > > VTable* vTable; > }; > > Such definition of pure virtual interface should work and be correct for > any working C compiler. > > [snip] > > in C++ we get exactly same binary layout for any known to us C++ compiler.
Is this really so? This is why I'm asking: https://gcc.gnu.org/ml/gcc-help/2003-11/msg00257.html http://stackoverflow.com/questions/5712808/understanding-the-vtable-entries i.e. GCC has a different vtable layout and moreover it's version-dependent. As for Free Pascal, they also reserve 12 bytes at the beginning of the vtable, hence the compatibility issue. Dmitry ------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel