Am 19.02.2016 um 14:31 schrieb Montes C?mara, Victor:

> I've been using sqlite in vba6 for some years
 > using RichClient3 framework of Olaf Schmidt (www.datenhaus.de)

The new site (which offers a new version of the RichClient,
as well as new versions of __stdcall-compiled SQLite... as
e.g. version 3.11 currently) is now hosted here:
http://vbRichClient.com/#/en/Downloads.htm

> Now I'm migrating my application to 64 bits using vba7
 > in Windows 8.1.
> The problem I'm facing is with the LoadLibrary function
 > to load dynamically the DLL DirectCOM.dll

DirectCOM.dll (as well as vb_cairo_sqlite.dll - and dito the
COM-wrapper vbRichClient5.dll) - are all 32Bit-PE-Binaries.

And 32Bit-Dlls cannot be loaded into a 64Bit-Process (in
your case the 64Bit-version of your Excel-installation).

This has (BTW) nothing to do with the 64Bitness of the OS,
which can run both kind of *Processes* (32Bit and 64Bit) -
it's simply the restriction that 32Bit-Dlls are loadable
only by 32Bit-Processes - and the same thing holds true
for the pairing of 64Bit-Dlls and 64Bit-Processes.

That's also the reason, why basically two (nearly identical)
sets of system-dlls exist - one in \System32 (for the 64-
Bit-Dlls) - and the other set in \SysWow64 (32Bit-Dlls).

As for "using 32Bit-Dlls in a 64Bit-Excel-Process" - that's
(indirectly) possible, when you will use a kind of "64Bit-to-
32Bit-Broker-mechanism" (by creating a 32Bit-Process, which
in turn then loads and instantiates the 32Bit-COM-Dll(s) -
and then allows cross-process-communication between 64Bit-
Excel and the 32Bit-Process (named e.g. MyAXHost32Bit.exe).

This is possible over COM (not only across processes, but
also across machines) by (auto-created) 64Bit-COM-Proxy-
instances in the 64bit-Process - which will then "marshal"
all the Method-Calls between the 64Bit-Proxy-Class and the
real Class-instance (the 32Bit-one, which is hosted by the
Broker-Process (your self-compiled AXHost32Bit.exe).

VB6 allows the creation of such a 32Bit ActiveX-Executable
quite easily - and it can be implemented even generically,
by just this little code in e.g. a Public cConstruct-Class:

Public Function GetInstanceByProgID(ProgID As String) As Object
   Set GetInstanceByProgID = CreateObject(ProgID)
End Function

As said, that's all the code in the little AXHost32Bit.exe
that is necessary.

With that you can create and access any 32Bit-COM-Dll(Class)
which is registered on the System from within a 64Bit(-VBA)-Process.

You can even use Early-Binding within 64Bit-VBA7 by selecting
the (32Bit-)lib over the VBA7-"References"-dialogue (e.g.
the one for the newer COM-SQLite-wrapper 'vbRichClient5')
This will *not* load the 32Bit-COM-Dll itself - but restricts
itself to a lookup in the Resource-Section of said Dll-File, to
read only the TypeLib-Information (Classes and their Method-Defs).

With these Typelib-Infos Excel-64Bit is then capable to
(auto-)instantiate the appropriate, interface-compatible
(64Bit-)Proxy-Class within Excel (which then does the auto-
marshalling of method-calls to the real Class-instance which
runs within AXHost32Bit.exe.

Sorry for the somewhat longer post, which is only indirectly
related to SQLite(-usage).
To get more details you might want to ask further questions
in a VB6-NewsGroup or on vbForums.com...

Olaf

Reply via email to