CLR 2.0 Sleep Call.

  • Thread starter Thread starter Bob
  • Start date Start date
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
 
Any suggestions on how to remedy this would be appreciated.

Call System.Threading.Thread.Sleep instead.


Mattias
 
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
 
Back
Top