Re: [sqlite] sqlite3 dll symbols

2006-04-04 Thread Essien Essien
thanks you all for the explanations. It was a small project for a friend and
nothing critical really. I'm no windows guru, and i'm not so sure i want to
be (what with all the hoops and noops) ;)

Now back to Linux defender of... oops that's Voltron :)

On 4/1/06, John Stanton < [EMAIL PROTECTED]> wrote:
>
> Dennis Jenkins wrote:
> > Essien Essien wrote:
> >
> >>hiya,
> >>
> >>I have a code snippet that looks like:
> >>
> >>typedef int (*SQLITE3_CLOSE)(sqlite3*);
> >>typedef const char* (*SQLITE3_ERRMSG)(sqlite3*);
> >>typedef int (*SQLITE3_OPEN)(const char*, sqlite3**);
> >>typedef int (*SQLITE3_EXEC) (sqlite3*, const char*, sqlite3_callback,
> void*,
> >>char**);
> >>
> >>HINSTANCE sqlite3_dll;
> >>
> >>SQLITE3_CLOSE _sqlite3_close;
> >>SQLITE3_ERRMSG _sqlite3_errmsg;
> >>SQLITE3_OPEN _sqlite3_open;
> >>SQLITE3_EXEC _sqlite3_exec;
> >>
> >>int DB_Init()
> >>{
> >>sqlite3_dll = LoadLibrary("sqlite3.dll");
> >>if (sqlite3_dll == NULL) {
> >> printf("Cannot find sqlite3.dll. Make sure its in the same
> >>directory as the program\n");
> >> return 0;
> >>}
> >>
> >>_sqlite3_open = (SQLITE3_OPEN)GetProcAddress(sqlite3_dll,
> >>"sqlite3_open");
> >>if (_sqlite3_open == NULL) {
> >>printf("Cannot load function sqlite3_open");
> >>return 0;
> >>}
> >>}
> >>
> >>problem is, when ever i call DB_Init(), it always fails with 'Cannot
> load
> >>function sqlite3_open'. But it successfully passes the LoadLibrary
> portion.
> >>I'm not a win32 guru, so i'm willing to admit i've made a mistake
> somewhere.
> >>
> >>Any ideas on what i'm doing wrong?
> >>
> >>I'm using Turbo C++ 4.5 IDE and related tools. (yeah... i know turbo
> >>C++ 4.5is realy aged, but could this be the problem?)
> >>
> >>Essien
> >>
> >>
> >
> >
> > Since you have the borland compiler product, use the "TDUMP.EXE" tool to
> > view the PE header of the sqlite3.dll file.  Sometimes the functions
> > will be exported with a leading underscore.  If your compiler is
> > producing 32 bit binaries, and the DLL is also 32 bit, then you might
> > try adding a leading underscore to the symbol name when you call
> > 'GetProcAddress'.
> >
> You could also try statically linking Sqlite and bypassing the DLL.
>


Re: [sqlite] sqlite3 dll symbols

2006-03-31 Thread John Stanton

Dennis Jenkins wrote:

Essien Essien wrote:


hiya,

I have a code snippet that looks like:

typedef int (*SQLITE3_CLOSE)(sqlite3*);
typedef const char* (*SQLITE3_ERRMSG)(sqlite3*);
typedef int (*SQLITE3_OPEN)(const char*, sqlite3**);
typedef int (*SQLITE3_EXEC) (sqlite3*, const char*, sqlite3_callback, void*,
char**);

HINSTANCE sqlite3_dll;

SQLITE3_CLOSE _sqlite3_close;
SQLITE3_ERRMSG _sqlite3_errmsg;
SQLITE3_OPEN _sqlite3_open;
SQLITE3_EXEC _sqlite3_exec;

int DB_Init()
{
   sqlite3_dll = LoadLibrary("sqlite3.dll");
   if (sqlite3_dll == NULL) {
printf("Cannot find sqlite3.dll. Make sure its in the same
directory as the program\n");
return 0;
   }

   _sqlite3_open = (SQLITE3_OPEN)GetProcAddress(sqlite3_dll,
"sqlite3_open");
   if (_sqlite3_open == NULL) {
   printf("Cannot load function sqlite3_open");
   return 0;
   }
}

problem is, when ever i call DB_Init(), it always fails with 'Cannot load
function sqlite3_open'. But it successfully passes the LoadLibrary portion.
I'm not a win32 guru, so i'm willing to admit i've made a mistake somewhere.

Any ideas on what i'm doing wrong?

I'm using Turbo C++ 4.5 IDE and related tools. (yeah... i know turbo
C++ 4.5is realy aged, but could this be the problem?)

Essien

 



Since you have the borland compiler product, use the "TDUMP.EXE" tool to
view the PE header of the sqlite3.dll file.  Sometimes the functions
will be exported with a leading underscore.  If your compiler is
producing 32 bit binaries, and the DLL is also 32 bit, then you might
try adding a leading underscore to the symbol name when you call
'GetProcAddress'.


You could also try statically linking Sqlite and bypassing the DLL.


Re: [sqlite] sqlite3 dll symbols

2006-03-31 Thread Dennis Jenkins
Essien Essien wrote:
> hiya,
>
> I have a code snippet that looks like:
>
> typedef int (*SQLITE3_CLOSE)(sqlite3*);
> typedef const char* (*SQLITE3_ERRMSG)(sqlite3*);
> typedef int (*SQLITE3_OPEN)(const char*, sqlite3**);
> typedef int (*SQLITE3_EXEC) (sqlite3*, const char*, sqlite3_callback, void*,
> char**);
>
> HINSTANCE sqlite3_dll;
>
> SQLITE3_CLOSE _sqlite3_close;
> SQLITE3_ERRMSG _sqlite3_errmsg;
> SQLITE3_OPEN _sqlite3_open;
> SQLITE3_EXEC _sqlite3_exec;
>
> int DB_Init()
> {
> sqlite3_dll = LoadLibrary("sqlite3.dll");
> if (sqlite3_dll == NULL) {
>  printf("Cannot find sqlite3.dll. Make sure its in the same
> directory as the program\n");
>  return 0;
> }
>
> _sqlite3_open = (SQLITE3_OPEN)GetProcAddress(sqlite3_dll,
> "sqlite3_open");
> if (_sqlite3_open == NULL) {
> printf("Cannot load function sqlite3_open");
> return 0;
> }
> }
>
> problem is, when ever i call DB_Init(), it always fails with 'Cannot load
> function sqlite3_open'. But it successfully passes the LoadLibrary portion.
> I'm not a win32 guru, so i'm willing to admit i've made a mistake somewhere.
>
> Any ideas on what i'm doing wrong?
>
> I'm using Turbo C++ 4.5 IDE and related tools. (yeah... i know turbo
> C++ 4.5is realy aged, but could this be the problem?)
>
> Essien
>
>   

Since you have the borland compiler product, use the "TDUMP.EXE" tool to
view the PE header of the sqlite3.dll file.  Sometimes the functions
will be exported with a leading underscore.  If your compiler is
producing 32 bit binaries, and the DLL is also 32 bit, then you might
try adding a leading underscore to the symbol name when you call
'GetProcAddress'.



[sqlite] sqlite3 dll symbols

2006-03-31 Thread Essien Essien
hiya,

I have a code snippet that looks like:

typedef int (*SQLITE3_CLOSE)(sqlite3*);
typedef const char* (*SQLITE3_ERRMSG)(sqlite3*);
typedef int (*SQLITE3_OPEN)(const char*, sqlite3**);
typedef int (*SQLITE3_EXEC) (sqlite3*, const char*, sqlite3_callback, void*,
char**);

HINSTANCE sqlite3_dll;

SQLITE3_CLOSE _sqlite3_close;
SQLITE3_ERRMSG _sqlite3_errmsg;
SQLITE3_OPEN _sqlite3_open;
SQLITE3_EXEC _sqlite3_exec;

int DB_Init()
{
sqlite3_dll = LoadLibrary("sqlite3.dll");
if (sqlite3_dll == NULL) {
 printf("Cannot find sqlite3.dll. Make sure its in the same
directory as the program\n");
 return 0;
}

_sqlite3_open = (SQLITE3_OPEN)GetProcAddress(sqlite3_dll,
"sqlite3_open");
if (_sqlite3_open == NULL) {
printf("Cannot load function sqlite3_open");
return 0;
}
}

problem is, when ever i call DB_Init(), it always fails with 'Cannot load
function sqlite3_open'. But it successfully passes the LoadLibrary portion.
I'm not a win32 guru, so i'm willing to admit i've made a mistake somewhere.

Any ideas on what i'm doing wrong?

I'm using Turbo C++ 4.5 IDE and related tools. (yeah... i know turbo
C++ 4.5is realy aged, but could this be the problem?)

Essien