Re: DllImport - Problem

From: Andreas Weizel (doeners3002spameater_at_geekmail.de)
Date: 06/20/04


Date: Sun, 20 Jun 2004 19:48:20 +0200

Hallo Christian

Christian Breit schrieb:
> void ConAlloc (unsigned char *Cid, char *TcpId, unsigned
> short HostPort, unsigned short PCPort, unsigned short
> Timeout, unsigned short SecFlag, unsigned short SecOff,
> long *rc);
>
> [...]
>
> [DllImport("lib.dll",
> CallingConvention=CallingConvention.StdCall)]
> public static extern void ConAlloc (StringBuilder CId,
> string sAdress, int iHostPort, int iPCPort, int iTimeOut,
> int iCheckPwd, int iWithoutSecurity, out int iReturnCode);

Der Datentyp "unsigned short" aus C++ entspricht in C# dem "ushort"
(bzw. System.UInt16) und besteht aus 16 Bits. Du verwendest stattdessen
den Typ "int", welcher 32-bittig ist. Vielleicht führt das zur Exception?

MfG

-- 
Andreas Weizel ("Rpinski")
http://www.awzhome.de/

Loading