I have been experimenting with seeing if I can access the new Firebird 3
API - IMaster etc, from Pascal using the Free Pascal compiler on 64-bit
linux and the answer is probably not surprising - it is no, I can't
access it.

For example. I have translated the IVersioned interface to

IVersioned = interface
 function getVersion: integer;
        {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
    function getModule: IPluginModule ;
        {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
end;

and IMaster to

IMaster = interface (IVersioned)
    function getStatus: IStatus;
        {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
    function getDispatcher: IProvider;
        {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
....


Accessing the interface works fine with

var Master: IMaster;

Master :=  fb_get_master_interface;

but as soon as you try to do something useful, such as

MyVersionNo := Master.getStatus;

you get an access violation. As I said, not too surprising as the
probability was that C++ classes are not laid out identically to the way
that FPC expects an interface class to be - as it is based on COM
interfaces.

So was there any intent or expectation that the new Firebird 3 API
should be usable from anything other than C++?

If there is no easy way to access the new API from other programming
languages then this is very disappointing as it means that the old API
is the only way of using Firebird from Pascal, Lazarus, Delphi, etc. and
any new features will be off limits.

May I humbly suggest that a language independent version of the new API
is also made available - perhaps by defining
tables of function pointers.

Tony Whyman
MWA

------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to