2013-04-24 52 views
0

我正在使用DLL導入來使用C dll中的某些功能。該功能的簽名是如何在C#中爲DLL導入指定正確的封送處理器

int dllfunction(myfile **fptr, const char *filename, int *status); 

什麼編組代碼進入下面的行,所以我可以訪問該函數?

[DllImport("name.dll")] 
public static extern int dllfunction(??); 

我已經試過

[DllImport("name.dll")] 
public static extern int dllfunction(
    IntPtr fptr, 
    [In] ref char filename, 
    ref int status); 

在MSDN尋找尚未幫助。如果你能夠給出答覆,你是否也介意給出一個調用示例(例如,如果需要施放)。

感謝您的期待!

巴克

回答

2

這是什麼小信息被張貼在最好的猜測:

[DllImport("name.dll", CallingConvention = CallingConvention.Cdecl)] 
public static extern int dllfunction(
    out IntPtr fptr, 
    string filename, 
    ref int status 
); 
+0

謝謝!這工作完美。你認爲哪些其他信息可能會有幫助,所以下次我可以考慮?再次感謝。 – Buck 2013-04-25 15:50:23

+0

描述該功能的功能。聲明中的out和ref是猜測。 – 2013-04-25 15:51:43

+0

明白了 - 謝謝。如果需要,我可以在未來的職位上更具體一些。 – Buck 2013-04-25 17:56:55