我完全疲憊/沮喪似乎是一個相當容易的任務。我不確定我做錯了什麼;更別說如果我做得正確。我需要在開發WPF應用程序(VS 2010,C#4.0)時使用現有庫(一個C靜態庫 - 超過100,000行直C代碼)。哦,我無法觸摸現有的C代碼 - 按原樣使用!
我已經閱讀了很多帖子(高級主題,how-to等),但我對C++/CLI很陌生,它只是沒有意義。從我讀過的最好的辦法是包的C靜態庫如下:
非託管c靜態庫< ---> C++/CLI託管包裝DLL < ---> 管理WPF應用程序
這在剝離下來的C頭文件:
/* Call this function to execute a command. */
int issue_command(int command, long param1, long param2);
/* Completion call back function; you must supply a definition. */
extern int command_completed(int command, long param1, long param2);
struct struct_command_str
{
char command_str[10];
char param1_st[2];
char param2_st[2];
char success;
};
/* You must supply definitions to the following extern items. */
extern int command_status;
extern struct struct_command_str command_str;
的問題(S):
我似乎無法正確執行的是爲回調函數和兩個外部項目(command_status
和struct command_str
)提供C++/CLI實現。
有人可以提供一個示例C++/CLI實現上述缺少回調函數和外部?
在此先感謝您的幫助。
在你的C++/CLI託管包裝項目
您可以在C++/CLI實現中至少包含一次失敗的嘗試嗎? – 2011-02-10 16:50:10