Declare statements and DLL loading rules

I’m asking here because I don’t find nothing in the documentation on this topic.
On Windows targets (both 32 and 64 bits) how a Xojo program resolve the file path when loading DLL referred by Declare statements?
There is any feature for the program to control where to look for the requested DLL?

I know that for a single DLL I can set the full path of the DLL itself but how, if possible, can be controlled the loading of any nested DLL required by the first one?
If this process can’t be modified/controlled/changed what are the rules used?

Regards

Locating and loading of DLLs is performed by Windows rather than by Xojo. You can read about loading process here, but there’s no way to change it.

I don’t think so…

You can specify the full path to the library so this is under program control.
A Xojo app find the "private° dll in the "libs° or “appname libs” folder.
So this can confirm that Xojo is doing something well defined about locating a dll on disk.
What exactly is done and which kind of control can be done in the user application it not documented or not kown to me.

DLL load path used by Xojo is

  1. The directory from which the application loaded.
  2. The directory specified by the “MyApplication Libs” or “Libs” folder
  3. The system directory. Use the GetSystemDirectory function to get the path of this directory. The name of this directory is System32.
  4. 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.
  5. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
  6. The directories that are listed in the PATH environment variable.

Only #2 is unique to Xojo and the rest is normal Windows behavior

Thank you Normam.

Of note, I’m pretty sure that this path, “MyApplication Libs” is baked into the EXE file when the IDE builds it. So, if you rename your EXE, it will not be able to find the DLLs any longer. Is that true in Xojo?

Xojo should behave the same

Hello!

The dll can be development in any program languaje?

[quote=37944:@claudia orona flores]
The dll can be development in any program languaje?[/quote]
As far as I know as long as its not exporting C++ classes or C++ mangled names things should just work.

[quote=21950:@Norman Palardy]DLL load path used by Xojo is

  1. The directory from which the application loaded.
  2. The directory specified by the “MyApplication Libs” or “Libs” folder
  3. The system directory. Use the GetSystemDirectory function to get the path of this directory. The name of this directory is System32.
  4. 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.
  5. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
  6. The directories that are listed in the PATH environment variable.

Only #2 is unique to Xojo and the rest is normal Windows behavior[/quote]

And in DebugMode, how do I write the Declare to be able to use the dll?
Although I placed my dll in several places I always get this message:

Can you give us an example of your declare statement?

Declare Function ResolMatriu Lib “resolmatriu.dll” (mm As Ptr, qq As Ptr, nf as Integer, nc As Integer, St As Ptr) As Ptr

Ok, and are you sure that the DLL is in one of the places that Norman described when you ran the app? (you would be surprised how often people forget to copy the file during testing).

Yes.
You are right. Finally I got another error, but the DLL is found at System32 folder.
Thanks.