realbasic-nug
[Top] [All Lists]

Re: International Libraries on Windows

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: International Libraries on Windows
From: Aaron Ballman <aaron at realsoftware dot com>
Date: Tue, 06 Dec 2005 09:30:05 -0600
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <5c8121ef0512060615s40d74c7ep8afdc596005274db at mail dot gmail dot com> <4395AAE4 dot 5000506 at realsoftware dot com> <5c8121ef0512060722y140cb1dpb3744d3ec23d2e7 at mail dot gmail dot com>
Yeah no kidding it breaks easily. But I thought you *had* to use hard-coded
build-time paths for loading 3rd party libraries. @executable_path is
mac-only, right? So on Windows the declare statement needs to use the full
path to the 3rd party library.

You're right in that @executable_path is Mac-Only, but you're wrong about using hard-coded paths. You should never use them!

My library is a private one. I install (with Vice) at the time my program
gets installed. Since we are talking about windows, there aren't
subdirectories of the program, since the program is a single .EXE file. But
next to the progam I have a support folder, and in sub-folders of this I
have my library that the declare statements use.

You've got two options. 1) You can move the DLL file so that it resides next to your executable. 2) You can use some declares to make it work ( the recommended declare requires XP SP 1 or higher, but there are some other hacks you could use in place of a hard-coded path).

I'd do #1 -- it's the easiest solution. If you absolutely can't, then let me know and I'll show you how to do #2 properly.

The only thing that doesn't make sense is how to do a declare on Windows to
a library, when I thought I had to a) use a constant, and b) the constant
had to be an absolute, not relative, path.

Can the path be relative? If so, that solves all my problems.

No, but there's a specific search path that libraries use when loading them.

Essentially (in order):

1) The directory from which the application loaded.
2) The system directory. Use the GetSystemDirectory function to get the path of this directory. The name of this directory is System32. 3) The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched. The name of this directory is System. 4) The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
5) The directories that are listed in the PATH environment variable.

~Aaron
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>