How use "Declare Function"?

I’m trying to use, for the first time, external DLL in my projects. From the documentation I read I have to use something like

Declare Function MchpUsbOpen Lib "MPLABConnect.dll" (indiceHub as UInt8) As Integer

but how xojo find the DLL??? Where have I to put it?

Use a CopyFiles build step to copy it to the “Libraries” destination. This will put it where it needs to be.

thanks. I had already tried this solution, copying from a project made by my predecessor, but it doesn’t work (I use Xojo 2019).

at least that the error is not that it cannot find the dll, but that it cannot connect it

the destinations I have in list are:

App Parent

In that version the correct destination would be “Framework”

On Windows, this ends up being the MyApp Libs folder. It should be able to automagically find it there.

Okay, something has changed. Now I get a FunctionNotFoundException … at least it has changed.

thank you

Do you have a dylib?
Don’t think calling a .dll will work on Mac

what is dylib?
obviously if I talk about dll, I work on windows

Right, ok then
good luck

  • if it’s a 64 bit windows app and DLL, then the Copy Files destination needs to be App Parent.
  • 32 bit DLL? Then use Framework
1 Like