如何将这个C ++代码转换为C#代码(plz给我一个解决方案) [英] How to convert this C++ code to C# code(plz give me a solution)

查看:73
本文介绍了如何将这个C ++代码转换为C#代码(plz给我一个解决方案)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

typedef struct _GLYDEPOSITCOUNTER_EX {
	unsigned int EventNumber;						 
	struct tm Time;									
	unsigned int dwSquentialNo;						 
	unsigned int dwTransactionNo;								
	char chUserID[GLY_DEPOSIT_OPERATORID_ASCIIMAX];	
	GLYCOUNTERS DepositData;						
} GLYDEPOSITCOUNTER_EX, *LPGLYDEPOSITCOUNTER_EX;


typedef struct _GLYDENOMINATION {
    unsigned int  ulArraySize;
    LPGLYCURRENCY lpCurrencies;
} GLYDENOMINATION, *LPGLYDENOMINATION;

typedef struct _GLYCOUNTER {
    unsigned int    dwID;
    unsigned int    dwStatus;
    GLYDENOMINATION Denomination;
    void* misc;
} GLYCOUNTER, *LPGLYCOUNTER;





我尝试过:



i试用这两个





What I have tried:

i tried with this two

[MarshalAs(UnmanagedType.Struct)]
public GloryDE100.Internal._GLYCOUNTERS DepositData;
            

[MarshalAs(UnmanagedType.SysInt)]
public IntPtr DepositData;







------------- ---- GloryDE100是Dll ------------------------




-----------------GloryDE100 is Dll------------------------

推荐答案

你需要声明结构的所有字段。请参阅 StructLayoutAttribute类(System.Runtime.InteropServices) [ ^ ]。
You need to declare all the fields of the structure. See StructLayoutAttribute Class (System.Runtime.InteropServices)[^].


这篇关于如何将这个C ++代码转换为C#代码(plz给我一个解决方案)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆