Re: Use of a DLL from a fingerprint reader. DLLImport problems..

Tech-Archive recommends: Speed Up your PC by fixing your registry



i'm new at this forum as well as programming in .net

Welcome!


And i have used DLLImport as follows:
<DllImport("C:\WisClient.dll", EntryPoint:="Wis_Diagnose",
SetLastError:=True, _
CharSet:=CharSet.Unicode, ExactSpelling:=True, _
CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function Diagnostico( _
ByVal pwd As String, _
ByRef systemdata As SystemData) _
As Integer
End Function

However, the application doesn't work... One of the error message that shows
is:
PInvokeStackImbalance was detected
Message: A call to PInvoke function ....' 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.
Some other times (for example, when i change byref instead of byval), the
above error message doesn't show but it appears an unhandled win32
exception...

To match the C signature, the SystemData parameter should indeed by
passed ByVal.

You should also change the CharSet from Unicode to Ansi.

If it still doesn't work, please post your declaration of SystemData.



Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
.