2011-04-01 74 views
3

我有DLL函數的DllImport - C型到.NET類型

DLLExport int PatchSomething(char*, char*, DWORD, unsigned char*, unsigned short int); 

,但不能完全傳遞參數到.NET

F#:

模塊RNInvoke

open System 
open System.Runtime.InteropServices 
open Microsoft.FSharp.NativeInterop 
open Microsoft.FSharp.Math 

module Native = 
    [<System.Runtime.InteropServices.DllImport("DesuDLL.dll",EntryPoint="add")>] 
    extern int PatchSomething(char*, char*, DWORD, unsigned char*, unsigned short int); 

或C#

無符號字符210個

錯誤*無符號短整型

回答

3

試着這麼做:

[DllImport("DesuDLL.dll")] 
private static extern int PatchSomething(string a,string b,uint c,string d,ushort e); 

您可能需要扔字符集=自動進入屬性了。我唯一擔心的是無符號字符指針。