Home > Net >  C # call C DLL library structure types of how the data transfer and accept returns, bosses code inst
C # call C DLL library structure types of how the data transfer and accept returns, bosses code inst

Time:12-02

C # written call c + + DLL library structure types of how the data transfer and accept returns, bosses code instruction;

CodePudding user response:

[MarshalAs (UnmanagedType ByValArray, SizeConst=20)]

CodePudding user response:

Public struct A
{
[MarshalAs (UnmanagedType ByValArray, SizeConst=20)]
Public String x {get; set; }
[MarshalAs (UnmanagedType ByValArray, SizeConst=20)]
Public String y {get; set; }
}

Public struct B
{
[MarshalAs (UnmanagedType ByValArray, SizeConst=20)]
Public StringBuilder X {get; set; }
[MarshalAs (UnmanagedType ByValArray, SizeConst=20)]
Public StringBuilder Y {get; set; }
}

CodePudding user response:

Please first baidu "c # pinvoke" information, understand the basic knowledge, because behind my hand knock code, just write general meaning,

 [ChartSet=ChartSet. Ansi]//there are some features labeling, according to what you baidu you understand 

Int VicQuery (CardidPacket pszCaridPacket, ref VicPacket pszVicPacket)

[StructLayout (LayoutKind. Sequential CharSet=CharSet. Ansi)]
Struct CardidPacketNo
{
[MarshalAs (UnmanagedType ByValTStr, SizeConst=30)]
Public string CardNo.

//basic so, I'll seal a field, behind you continue to seal according to the above things, you are pictures, I this context compared with typing some small depressed
}

//behind another structure according to the above that you come, I will not continue to
  •  Tags:  
  • C#
  • Related