C ++、C#のDLLのchar上のインバウンドとアウトバウンドのパラメータで呼び出します*

プロトタイプのC ++ DLLインターフェイス:INT CheckSN(CONSTチャー* InfoList、CHAR * MSG)。

C#の呼び出しに:

[DLLIMPORT( "sncplusInterface.dll"、エントリーポイント= "CheckSN"、ExactSpelling =偽、CallingConvention = CallingConvention.Cdecl)]
パブリックstatic int型のextern CheckSN(ストリングInfoList、StringBuilderのMSG)。

呼び出しは、次のとおりです。

StringBuilderのchOutMsg =新しいStringBuilderの(1024);

CheckSN(chData、chOutMsg / * REF chOutMsg * /);

文字列STR = chOutMsg.ToString()。

REFとまたはキーワードクラッシュアウト

 

おすすめ

転載: www.cnblogs.com/bigfi/p/12521958.html