我想用C#編寫DMX Lightcontrol軟件。我的問題是,我必須重寫Delphi到C#的DLL調用。下面的代碼顯示了我的嘗試:在c#中重寫Delphi DLL-調用
//德爾福代碼:
function GetDMXInterface: pchar; stdcall; external 'DMX510.dll';
function SetLevel(a: array of byte): boolean; stdcall; external 'DMX510.dll';
function GetMaxChannels: integer; external 'DMX510.dll';
//我自己的C#-Code:
[DllImport("DMX510.DLL")]
public static extern char* GetDMXInterface();
[DllImport("DMX510.DLL")]
public static extern Boolean SetLevel(Byte[] bytearray);
[DllImport("DMX510.DLL")]
public static extern int GetMaxChannels();
下一個問題是如何從GetDMXInterface返回的字符指針轉換( )to a字符串
感謝您的幫助!
你有這個: http://stackoverflow.com/questions/508227/how-to-import-const-char-api-to-c 聽起來完美的你... – Stef