On 7-2-2018 23:38, Vlad Khorsun via Firebird-devel wrote:
   Yes, sure.

  BTW, in Firebird 3 role of fb_shutdown is even more important as it uses plugin
architecture and many code layers are at separate DLL's now.

I was just experimenting with Jaybird, and I noticed an odd inconsistency with fb_shutdown_callback on Windows. For other callbacks in fbclient (ie the event callback), I must define the callback using StdCall calling conventions.

   Hmm...

If I don't, things break. For the shutdown callback, using the 'normal' JNA calling convention (which I assume is cdecl) just works.

  In ibase.h all callback prototypes are declared not using ISC_EXPORT macro (this macro expands into __stdcall). So, i see no inconsistency there: (almost) all ISC API functions declared using ISC_EXPORT and all callbacks are without ISC_EXPORT.

However with fb_shutdown_callback, if I do apply the StdCall convention, then the callback is invoked, but the application ends with error 0xC0000409 ('unknown exception').

   As expected.

I haven't (yet) defined the method fb_shutdown_callback to explicitly accept the StdCall callback (contrary to isc_queue_events), but I'm surprised that it actually works without changing the calling convention. Is this something specific to the shutdown callback?

   So far i see no specific here.

I don't think I'll actually need the callback, but I'll make some further tests to see what happens if I have the definition the same to the event callback.

Mark
--
Mark Rotteveel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to