Page 1 of 1

Loading client library from pre-defined directory

Posted: 26.09.2009, 11:00
by trupka
Anyone knows how to "tell" ZEOS Connection to load client libraries from particular directory/path in pre-winXPSP1 OSes (where SetDLLDirectory API function is not available)?

Problem is when ZEOS is used inside DLL (not exe) and that DLL and database client libs are not inside search path and are not in exe directory which uses this DLL (they are in same dir where DLL resides). In that scenario client libraries are out of scope of TZNativeLibraryLoader.LoadNativeLibrary function.

IMHO, possible solution is extending TZNativeLibraryLoader with Locations property - when I look at the source, that seems like unfinished work, but maybe there is some, already existing, better way??

Posted: 27.09.2009, 14:05
by mdaems
Hi Trupka,

As far as I know there's no way to do that with the 6.6 version.

However, in the 7.x branch we already took a first step reorganising the plaindriver classes. The original design only allowed for a hardcoded series of driver classes for evey database family. Now we changed this to allow for an unlimited number of plaindriver objects within a specific driver class.
I believe it should be possible to create new 'protocols' at runtime specifying which library they use. Unfortunately we didn't complete this feature yet. Mostly because it's not a priority for me and I have no clear vision on how it should be integrated in the components or the dbc layer.
Please have a look at what happens in TZMySQLDriver.Create;
If we do some changes to allow programmers to manage the fplaindrivers array of the TZAbstractDriver derived classes you have what you need, I think.
I think the first thing to do would be to extend TZAbstractPlainDriver.CreateWithLibrary(LibName: String); with an extra 'protocolname' property. So one could create a new plaindriver object of a certain type using it's own library and having a protocol name that can be used to open a connection.

Do you feel like discussing/programming and testing this?

Mark