Null Delegate

  • Thread starter Thread starter Ken K
  • Start date Start date
K

Ken K

I have declared some externally defined methods. One of them takes a
pointer to function as a parameter. I created a delegate type
matching the signature of the function expected, then used that
delegate type in the DECLARE statement. In some instances the method
expects a null pointer to be in the calling sequence. How does one do
that in VB.NET?

Ken
 
Have you tried passing "Nothing" in the delegate's parameter? If this
causes exceptions in the unmanaged code, there's a workaround. In the VB
code, create a second declares statement to the same function, but with an
integer parameter instead of the delegate parameter. When you want to pass
a null pointer to the delegate's parameter, you use the second declaration
passing "Nothing" or zero to the integer parameter. This workaround
targets the fact that the unmanged code uses an integer pointer to the
function's address.




--------------------
 
Back
Top