Check if dll file exist?

Hi,
Has anybody Idea to check if dll file exist before Xojo will do it for you? Mean maybe in app.open something like
If my.dll not exit then
Msg (“you need my.dll”)
Quit()
End if
Before appear message box from xojo “Failed to load library my.dll”

Thanks,
Kris

Checking the existence of a file is easy, but I think you should do that in a helper app which checks the existence of the files prior to starting the app which needs to load them.
Guess you’re on Windows ?

Function FileExist(Path as String) As Boolean Dim f as new FolderItem(Path,3) if f.Exists then Return True else Return False end if

Hi Joost,
Yes it’s Windows but I think it will happens in any OS.
It’s just for dynamic library files check. I would like to handle this runtime error before xojo.

Thanks
Kris

[quote=235894:@Krzysztof Koninski]Yes it’s Windows but I think it will happens in any OS./quote]

Mac OS X does not have this issue, as the dylib files are placed in the bundle together with the executable.

In Windows, the best way to deal with this is to use an installer.

System.IsFunctionAvailable could be used

Call System.IsFunctionAvailable() for a function you know it’s in the DLL and if it’s missing, it will report false.

Are you finding the existence of a DLL so you can call it with a Declare? Just in case you don’t know, make sure your declares are Soft Declares. That means your app will check for the DLL at call-time, not on start up. There’s no way of checking for existence before your app checks if you declare using just “Declare”. You have to Soft Declare.

And be sure to handle the FunctionNotFoundException that can be thrown if the DLL is missing.

I learned something new here. Think this would be the way to go.

Hi All,
Sorry for so late response, I was checking all options.
With soft declare works as expected, thank you Garth.
Other way I cannot use External Methods to the class but I can live with that :slight_smile:

Thanks,
Regards,
Kris

Upfff Ok I found this big check box for soft declare in external method.