Hello,

It could be done using something like that  :

===========
sharedenv.h        // used in calling program and DLL.
===========
typedef  struct{
    pointer to functions funA,funB ... etc
} mysharedfuns;

=========
Main Program
=========
mysharedfuns sharedfuns;

main()
{
     sharedfuns.funA= <Pointer to the function funA>
    .. etc
     LoadLibray (DLL);
     InitDLL(&sharedfuns);
}

=========
 DLL:
=========
#include <sharedenv.h>
mysharedfuns mainfuns;

int InitDLL(mysharefuns *src)
{
    mainfuns.funA=src->funA;
   etc ..
}

The InitDLL function has to be called from the main program just after the
LoadLibrary.
The shared environment is then initialized; functions funA,funB ... are
callable from the DLL..

Best regards,

Laurent Blanquet.
==

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: "Sqlite-users" <sqlite-users@sqlite.org>
Sent: Wednesday, June 07, 2006 4:30 PM
Subject: [sqlite] DLLs containing user-defined SQL functions


I'm trying to add the ability to dynamically load DLLs
containing SQL functions and collating sequences to
SQLite.  Things are working great on Unix, but I'm having
issues with Windows.  Windows experts, please help me.

Suppose the main program (the .exe file) contains a
function procA() and the DLL contains a function procB().
I want procB() to be able to call procA().  The idea
is that the main program uses LoadLibrary() to pull
in the DLL, then GetProcAddress() to find the address
of procB().  Then the main program calls procB() in
the DLL which in turn calls procA() in the main program.

This all works great on Unix.  When I use dlopen() to
attach the shared library, the procA() reference in
the shared library is automatically resolved to the
address of procA() in the main program.

But on Windows, I cannot get the DLL to compile because
it is complaining about the missing procA().

Another way to ask the question is this:  How do I build
a DLL in windows that can call routines contained in the
main program that attached the DLL using LoadLibrary()?

--
D. Richard Hipp   <[EMAIL PROTECTED]>

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: "Sqlite-users" <sqlite-users@sqlite.org>
Sent: Wednesday, June 07, 2006 4:30 PM
Subject: [sqlite] DLLs containing user-defined SQL functions


I'm trying to add the ability to dynamically load DLLs
containing SQL functions and collating sequences to
SQLite.  Things are working great on Unix, but I'm having
issues with Windows.  Windows experts, please help me.

Suppose the main program (the .exe file) contains a
function procA() and the DLL contains a function procB().
I want procB() to be able to call procA().  The idea
is that the main program uses LoadLibrary() to pull
in the DLL, then GetProcAddress() to find the address
of procB().  Then the main program calls procB() in
the DLL which in turn calls procA() in the main program.

This all works great on Unix.  When I use dlopen() to
attach the shared library, the procA() reference in
the shared library is automatically resolved to the
address of procA() in the main program.

But on Windows, I cannot get the DLL to compile because
it is complaining about the missing procA().

Another way to ask the question is this:  How do I build
a DLL in windows that can call routines contained in the
main program that attached the DLL using LoadLibrary()?

--
D. Richard Hipp   <[EMAIL PROTECTED]>

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: "Sqlite-users" <sqlite-users@sqlite.org>
Sent: Wednesday, June 07, 2006 4:30 PM
Subject: [sqlite] DLLs containing user-defined SQL functions


I'm trying to add the ability to dynamically load DLLs
containing SQL functions and collating sequences to
SQLite.  Things are working great on Unix, but I'm having
issues with Windows.  Windows experts, please help me.

Suppose the main program (the .exe file) contains a
function procA() and the DLL contains a function procB().
I want procB() to be able to call procA().  The idea
is that the main program uses LoadLibrary() to pull
in the DLL, then GetProcAddress() to find the address
of procB().  Then the main program calls procB() in
the DLL which in turn calls procA() in the main program.

This all works great on Unix.  When I use dlopen() to
attach the shared library, the procA() reference in
the shared library is automatically resolved to the
address of procA() in the main program.

But on Windows, I cannot get the DLL to compile because
it is complaining about the missing procA().

Another way to ask the question is this:  How do I build
a DLL in windows that can call routines contained in the
main program that attached the DLL using LoadLibrary()?

--
D. Richard Hipp   <[EMAIL PROTECTED]>

Reply via email to