dbTalk Databases Forums  

64 bit dbtools interface - ASA 11

sybase.public.sqlanywhere.general sybase.public.sqlanywhere.general


Discuss 64 bit dbtools interface - ASA 11 in the sybase.public.sqlanywhere.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Bob Moore
 
Posts: n/a

Default 64 bit dbtools interface - ASA 11 - 10-07-2010 , 01:18 PM






We've been trying to get some backup code (which works fine on 32 bit
Sybase ASA 11) ported to work on the 64 bit database engine.

The original code was delphi, but we've ported it to C++ as faithfully
as possible, under VS2010 in x64 mode. DBToolsInit works fine and
gives no error. The code to invoke DBbackup is as follows:

#include "dbtools.h"

The callbacks are declared like this:

short __stdcall ErrorCallbackBackup (const char * str);
short __stdcall InfoCallback (const char * str);
short __stdcall ConfirmCallback (const char * str);
short __stdcall StatusCallback (const char * str);

The relevant struct is defined as follows:

a_backup_db g_backup_info;

the structure setup is as follows:

ZeroMemory (&g_backup_info, sizeof(g_backup_info));
g_backup_info.version = DB_TOOLS_VERSION_NUMBER;
g_backup_info.output_dir = g_szBackupDir;
g_backup_info.connectparms = g_szConnectStr;
g_backup_info.confirmrtn = ConfirmCallback;
g_backup_info.errorrtn = ErrorCallbackBackup;
g_backup_info.msgrtn = InfoCallback;
g_backup_info.statusrtn = StatusCallback;
g_backup_info.chkpt_log_type = BACKUP_CHKPT_LOG_DEFAULT;
g_backup_info.page_blocksize = 0;

g_backup_info.backup_database = 1;
g_backup_info.backup_logfile = 1;
g_backup_info.no_confirm = 1;

We invoke DBBackup like this

result = DBBackup(&g_backup_info);

We've also tried an explicit approach like this:

HINSTANCE hinst;
short (__stdcall * pdbbackup) (const a_backup_db *);

hinst = LoadLibrary (TEXT("dbtool11.dll"));
if (hinst != NULL)
{
pdbbackup = (short (__stdcall *) (const a_backup_db *)) GetProcAddress ((HMODULE)hinst, "DBBackup");
result = (*pdbbackup)(&g_backup_info);
FreeLibrary (hinst);

It made no difference...

Each callback is defined something like this

extern short __stdcall ErrorCallbackBackup (const char * str)
{
...
}

*** The structure packing is set to 1-byte ***

WIN64 and _WIN64 are defined, and we're point at the x64 LIB location
for Sybase (developer edition is installed).

EVERY SINGLE TIME we run this code, it fails with an access violation
in DBTOOL11.DLL

Can anybody shed any light on why this might be so?

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.