facdaar
Messages postés64Date d'inscriptionlundi 24 mars 2003StatutMembreDernière intervention23 février 2009
-
10 nov. 2004 à 22:08
cs_coq
Messages postés6349Date d'inscriptionsamedi 1 juin 2002StatutMembreDernière intervention 2 août 2014
-
15 nov. 2004 à 19:37
Salut,
Je désire utiliser une dll native (en l'occurence cellcore.dll, mais peu importe) et j'ai un problème avec une structure en C que je veux déclarer en C# : j'ai beau respecter ce qui est écrit dans MSDN, ou d'autres sources, j'ai toujours l'erreur
The type or namespace name 'MarshalAs' could not be found (are you missing a using directive or an assembly reference?)
using System.Runtime.InteropServices;
...
[StructLayout(LayoutKind.Sequential)]
public struct SimPhonebookEntry {
public uint cbSize;
public uint dwParam;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=256)]
public char[] lpszAddress;
public uint dwAddressType;
public uint dwNumPlan;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=256)]
public char[] lpszText;
}
Est-ce que quelqu'un peut me dire pourquoi j'ai cette erreur alors que dans la littérature, il est écrit que la classe MarshalAsAttribute fait partie de System.Runtime.InteropServices
cs_coq
Messages postés6349Date d'inscriptionsamedi 1 juin 2002StatutMembreDernière intervention 2 août 2014101 10 nov. 2004 à 22:43
bizarre en effet
et si tu met
[StructLayout(LayoutKind.Sequential)]
public struct SimPhonebookEntry
{
public uint cbSize;
public uint dwParam;
[System.Runtime.InteropServices.MarshalAs(UnmanagedType.ByValArray, SizeConst=256)]
public char[] lpszAddress;
public uint dwAddressType;
public uint dwNumPlan;
[System.Runtime.InteropServices.MarshalAs(UnmanagedType.ByValArray, SizeConst=256)]
public char[] lpszText;
}