I am maintaining a VB6 program that does not use Option Explicit
. I know this is not a good idea but I did not write the code.
An example of my problem is that one variable called state
has been used in a procedure without Dim
.
A DLL
has since been introduced as a reference in the project. Now the compiler thinks that state
is referring to a global variable in the DLL
. Now a line in the code causes a type mismatch error.
How can I avoid this problem?
Ref: http://msdn.microsoft.com/en-us/library/aa241733(v=vs.60).aspx
If it is not too much of a bother, you can make another project as a wrapper around the dll, and only expose what you need. Your VB6 program should reference the wrapper instead of the original dll. If you need the global state from it, you can rename it. If not just hide it.