CLR 2.0 Sleep Call.

B

Bob

Hi,
Module written in 1.1 makes call to sleep.
The declaration in the module is:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Moved project to 2.0

Now I get an MDA Error:

PInvokeStackImbalance was detected
Message: A call to PInvoke function 'NameSpace.basGeneral::Sleep' has
unbalanced the stack. This is likely because the managed PInvoke signature
does not match the unmanaged target signature. Check that the calling
convention and parameters of the PInvoke signature match the target
unmanaged signature.


Any suggestions on how to remedy this would be appreciated.

Thanks

Bob
 
M

Mattias Sjögren

Any suggestions on how to remedy this would be appreciated.

Call System.Threading.Thread.Sleep instead.


Mattias
 
B

Bob

Thanks Tim,
Right on the money.
Works OK with an Integer in the declaration.
Re: The shared Thread sleep
Spot on.
The external call was historical.
I tried earlier but must have been asleep at the wheel. I made the call
Thread.CurrentThread.Sleep
and just panicked when it spat the dummy.

I'll go through and convert to Thread.Sleep
Thanks again
Bob
 

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