I need advice for what to put in my powerbasic source code so that the compiled program can run if the source code references a DLL that does not exist on the system,
My program has a few features that depends on a DLL being present, but most of the program does not rely on the DLL. I believed I had put sufficient protective logic into the source code: the main block in the code uses ISFILE to check if the DLL exists; if it does not, then the code does not attempt to invoke the Function that's in the DLL and instead displays a message box to the user.
But I discovered that program fails before ever reaching my protective behavior. There is a runtime error as soon as the program starts (on a system missing the DLL) without the program even reaching my instruction to check for the DLL's presence.
That is, I'm not getting the error message box that I coded. Instead, I'm getting a generic runtime error message box from powerbasic that it is "unable to locate component" with the DLL name.
I guess that's happening because I declare the function and the DLL at the top of my code before even entering the main block (e.g.,
DECLARE FUNCTION FunctionName LIB "DLLName.dll" ....
This error outcome is unacceptable for my purpose, because it means that my entire program--including the features not dependent on that DLL--cannot be run if the DLL is missing.
What can I do to declare the function in a way that my program will run regardless of the presence of the DLL?
My program has a few features that depends on a DLL being present, but most of the program does not rely on the DLL. I believed I had put sufficient protective logic into the source code: the main block in the code uses ISFILE to check if the DLL exists; if it does not, then the code does not attempt to invoke the Function that's in the DLL and instead displays a message box to the user.
But I discovered that program fails before ever reaching my protective behavior. There is a runtime error as soon as the program starts (on a system missing the DLL) without the program even reaching my instruction to check for the DLL's presence.
That is, I'm not getting the error message box that I coded. Instead, I'm getting a generic runtime error message box from powerbasic that it is "unable to locate component" with the DLL name.
I guess that's happening because I declare the function and the DLL at the top of my code before even entering the main block (e.g.,
DECLARE FUNCTION FunctionName LIB "DLLName.dll" ....
This error outcome is unacceptable for my purpose, because it means that my entire program--including the features not dependent on that DLL--cannot be run if the DLL is missing.
What can I do to declare the function in a way that my program will run regardless of the presence of the DLL?
Comment