I'm working with a model that references a hard coded file path that points to a .dll file. The code line used to declare the function is as follows:
The issue is that this model is used on a multitude of networks and that the "libname" needs to change for various users. Currently, the model will run even if this .dll file doesn't exist at the location specified. It even produces some semi-normal looking results, which is very dangerous.
Is it possible to return the address of the Lib for this Function "export_function" before the Function actually called/used in the code?
For example something like:
If it is not possible to return the directory of the .dll file, is there a better solution I can use to kill the code when someone attempts to run the model w/o the .dll file's path being updated correctly?
Code:
Private Declare PtrSafe Function export_function
Lib "\\network\public\myfolder\MyDLLFile.dll" _
(ByVal AddressOfStruct As LongPtr) As Long
The issue is that this model is used on a multitude of networks and that the "libname" needs to change for various users. Currently, the model will run even if this .dll file doesn't exist at the location specified. It even produces some semi-normal looking results, which is very dangerous.
Is it possible to return the address of the Lib for this Function "export_function" before the Function actually called/used in the code?
For example something like:
Code:
Dim CheckFilePath as String
CheckFilePath = Environ(export_function)
'If Statement to check if file exists at "libname" location...
If it is not possible to return the directory of the .dll file, is there a better solution I can use to kill the code when someone attempts to run the model w/o the .dll file's path being updated correctly?