Hi,

Thanks to Mark, Uffe, Trey and Bo, who replied on my question.

This was the result
1. You can't specify a path for a DLL, at least not using a function. It is 
possible to specify a hardcoded path as part of the dll name.
2. Let Windows do it's stuff ..... This one almost scared me ;-)
3. Copy the dll from the Windows\System32 folder to the application directory 
when the application is loaded, and hope that MapInfo has loaded the dll before 
you copy it.
4. Bo gave me a link to a description of the search order for dlls 
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/dynamic-link_library_search_order.asp)

So I guess, I just should rely on Windows finding the right dll for me.
It also turned out that my application worked proberly without the path, so I 
just hope it will work on other systems as well

Thanks,

Peter Horsbøll Møller
GIS Developer, MTM
Geographical Information & IT
 
COWI A/S
Odensevej 95
DK-5260 Odense S.
Denmark
 
Tel     +45 6311 4900
Direct  +45 6311 4908
Mob     +45 5156 1045
Fax     +45 6311 4949
E-mail  [EMAIL PROTECTED]
http://www.cowi.dk/gis

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Horsbøll 
Møller
Sent: Tuesday, February 14, 2006 12:27 PM
To: [email protected]
Subject: [MI-L] External dll with variable path

Hi,

Has anyone ever tried accessing an external dll in a variable location ?
I'm building a MapBasic application, that should use a dll placed in 
Windows\System32. On my computer I know ehere this is, but I guess I can't be 
sure whether it always will be located in C:\Windows on other computers ?

So how do I tell MapBasic to use the dll from the System32 folder ?

I can't use this:

Declare Function BLAccessFile$ Lib "C:\Windows\System32\BLMarkProvider.dll" 
Alias "udtraekDb" () As String

and this one the compiler doesn't like (APIWindowSystem32Folder$() is my own 
function returning the location of Windows\System32):

Declare Function BLAccessFile$ Lib APIWindowSystem32Folder$() + 
"BLMarkProvider.dll" Alias "udtraekDb" () As String

I also tried it with ApplicationDirectory$() but that didn't work either, so 
the problem might be the use of a function ??!!

and with this one I can't be sure that MapInfo will use the right dll:

Declare Function BLAccessFile$ Lib "BLMarkProvider.dll" Alias "udtraekDb" () As 
String

Any ideas ?

Peter Horsbøll Møller
GIS Developer, MTM
Geographical Information & IT
 
COWI A/S
Odensevej 95
DK-5260 Odense S.
Denmark
 
Tel     +45 6311 4900
Direct  +45 6311 4908
Mob     +45 5156 1045
Fax     +45 6311 4949
E-mail  [EMAIL PROTECTED]
http://www.cowi.dk/gis

_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l



_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to