0
0

I need to call the fmod.cll dynamically, since my app might need to find it in a location other than the application directory or current path.

Has anyone tried this before?

Thanks,
Elliott

  • You must to post comments
0
0

Put the fmod.dll in your system folder. That solves your problem. 😀

  • You must to post comments
0
0

Ken,

Don’t think I haven’t thought of that. :-)

But my application is going to put everything it needs on the disk on the fly, and clean it up afterward. If the user already has fmod.dll in his system directory, I’d want to honor that. Besides, why can’t I put it in my application’s directory just as well?

The second is that the DLL is one of the files the app itself will be putting on the disk, by way of extraction. I’d have to have a wrapper that extracts both the DLL and a “main” program that uses it statically on the disk, then calls the “main” program, which can then run because the DLL is now available. Not impossible, but probably more work than it’s worth.

Right now, I’m following the example of another poster who knocked the fmod.pas unit down to just the handful of functions he’s using, then coded the dynamic interfaces for those.

Thanks,
Elly

  • You must to post comments
0
0

If you install ‘fmod.dll’ in the same folder as your ‘.exe’, then you should be set.

Excerpt from MSDN for [url=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/dll_1o8p.asp:1n34im4d]LoadLibrary[/url:1n34im4d]…
[quote:1n34im4d]When no path is specified, the function searches for loaded modules whose base name matches the base name of the module to be loaded. If the name matches, the load succeeds. Otherwise, the function searches for the file in the following sequence:
[list=1:1n34im4d]
[:1n34im4d]The directory from which the application loaded.[/:m:1n34im4d]
[:1n34im4d]The current directory.
[b:1n34im4d]Windows XP[/b:1n34im4d]: If [b:1n34im4d]HKLM\System\CurrentControlSet\Control\SessionManager\SafeDllSearchMode[/b:1n34im4d] is 1, the current directory is searched after the system and Windows directories, but before the directories in the PATH environment variable. The default value is 0 (current directory is searched before the system and Windows directories).[/
:m:1n34im4d]
[:1n34im4d]The system directory. Use the GetSystemDirectory function to get the path of this directory.
[b:1n34im4d]Windows NT/2000/XP[/b:1n34im4d]: The name of this directory is System32.[/
:m:1n34im4d]
[:1n34im4d][b:1n34im4d]Windows NT/2000/XP[/b:1n34im4d]: 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.[/:m:1n34im4d]
[:1n34im4d]The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.[/:m:1n34im4d]
[:1n34im4d]The directories that are listed in the PATH environment variable.[/:m:1n34im4d][/list:o:1n34im4d]
The first directory searched is the one directory containing the image file used to create the calling process (for more information, see the CreateProcess function). Doing this allows private dynamic-link library (DLL) files associated with a process to be found without adding the process’s installed directory to the PATH environment variable.

[b:1n34im4d]Windows 2000/XP[/b:1n34im4d]: If a path is specified and there is a redirection file for the application, the function searches for the module in the application’s directory. If the module exists in the application’s directory, the LoadLibrary function ignores the specified path and loads the module from the application’s directory. If the module does not exist in the application’s directory, LoadLibrary loads the module from the specified directory. For more information, see Dynamic Link Library Redirection.[/quote:1n34im4d]

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.