| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1279 人关注过本帖
标题:C#如何用C++的DLL?
只看楼主 加入收藏
keithlsp
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2005-11-19
收藏
 问题点数:0 回复次数:2 
C#如何用C++的DLL?
我正在寫output board 的program, 但是那output board給的DLL是C++ version , 請問各位大大, 我如何才能在C#調用這個DLL?因為我試過Add reference, visual studio 2003 有error message
"A reference to 'C:\game\bin\Debug\Dii.dll' could not be added. This is not a valid assemble or COM component. Only assemblies with extension 'dll'and COM components can be referenced. Please make sure that the file is accessible, and that it is a valid assembly or COM component.

[此贴子已经被作者于2005-11-19 23:58:09编辑过]

搜索更多相关主题的帖子: DLL 
2005-11-19 23:46
zhangyingcai
Rank: 1
等 级:新手上路
帖 子:55
专家分:0
注 册:2005-9-3
收藏
得分:0 

好像是用DllImport引用一下所要使用的dll文件,然后声明一下需要使用的函数,好像就可以了,例子如下:

[DllImport("MyDll.dll",CharSet=CharSet.Auto)]


public static extern int GetNum(int Num);


2005-11-20 00:28
keithlsp
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2005-11-19
收藏
得分:0 
請問大大, 若果個Dll 有個class 叫 calculation, 而calcutation 有個function 叫(int)"abc", 請問我如何能夠拿這個"abc" function 來用
2005-11-20 02:32
快速回复:C#如何用C++的DLL?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011640 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved