Null Delegate

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
 
D

Dot Net Team [MSFT]

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.




--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top