Open kekyo opened 5 years ago
I wanted to write code like ...
[NativeValue("winsock2.h", SymbolName = "WSADESCRIPTION_LEN")]
static readonly int WSADESCRIPTION_LEN = 256;
[NativeValue("winsock2.h", SymbolName = "WSASYS_STATUS_LEN")]
static readonly int WSASYS_STATUS_LEN = 128;
[NativeType("winsock2.h", SymbolName = "WORD")]
struct WORD
{
public byte bLow;
public byte bHigh;
}
[NativeType("winsock2.h", SymbolName = "WSADATA")]
struct WSADATA
{
WORD wVersion;
WORD wHighVersion;
byte[] szDescription;
byte szSystemStatus;
ushort iMaxSockets;
ushort iMaxUdpDg;
IntPtr lpVendorInfo;
};
[NativeMethod("winsock2.h", SymbolName = "socket")]
static extern WSADATA WSAStartup(WORD wVersionRequested, LPWSADATA lpWSAData);
But I could not know how to write LPWSADATA (which is WSADATA*).
Thank you for taking up.
Memoized for me: the ref keyword in C#7, can we handle the field pointer type natural expressions?
For example, C# with P/Invoke way:
If IL2C/Invoke can handle directly it, very easier in the situation. We discussed how to implement this way for first inspirations:
In Roslyn, the code fragment understands the bar will copy instance into foo.field1. But IL2C will wirte the bar variable is the pointer:
We have to think more deep things:
@chameleonhead Thanks discussed and suggested at Center CLR Try development meetup No.6.