c#调用c++写成的dll文件,返回char*,返回数组,用ref接收,byte[]
2008-06-02 18:07
791 查看
// Inclusion guard
#ifndef _DLLTUT_DLL_H_
#define _DLLTUT_DLL_H_
// Make our life easier, if DLL_EXPORT is defined in a file then DECLDIR will do an export
// If it is not defined DECLDIR will do an import
#if defined DLL_EXPORT
#define DECLDIR __declspec(dllexport)
#else
#define DECLDIR __declspec(dllimport)
#endif
// Specify "C" linkage to get rid of C++ name mangeling
extern "C"
// End the inclusion guard
#endif
起因是,我想让c++的同事给我一个读取硬件编号的函数,没有参数,返回值是编号,可是我的同事说返回string不规范,返回结果应该是true或者false,然后利用参数返回值,就是利用指针返回编号,他就写了一个方法,我找了一些方法试验了一下,下面这种可行,希望给大家一点提示吧。
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace ConsoleApplication30
记录一些有用的链接吧
/article/5137577.html
http://www.cnblogs.com/wy/articles/123656.html
http://dotnet.csdn.net/page/aab1def7-35a4-4a5f-bd18-c82879278b22
http://www.liuwu.net/post/how-to-passing-structures-and-classes-to-unmanaged-code.aspx
/article/5460252.html
http://www.blue1000.com/bkhtml/2007-12/55484.htm
http://www.cnblogs.com/songwin/articles/1329545.html
最近老是碰到问题啊,提示“无法加载 DLL“FUKeyDll.dll”: 找不到指定的模块。 (异常来自 HRESULT:0x8007007E)。”,
这个问题也被解决了,多半是因为FUKeyDll.dll调用了其他的dll文件,缺少了其他的dll文件
#ifndef _DLLTUT_DLL_H_
#define _DLLTUT_DLL_H_
// Make our life easier, if DLL_EXPORT is defined in a file then DECLDIR will do an export
// If it is not defined DECLDIR will do an import
#if defined DLL_EXPORT
#define DECLDIR __declspec(dllexport)
#else
#define DECLDIR __declspec(dllimport)
#endif
// Specify "C" linkage to get rid of C++ name mangeling
extern "C"
// End the inclusion guard
#endif
起因是,我想让c++的同事给我一个读取硬件编号的函数,没有参数,返回值是编号,可是我的同事说返回string不规范,返回结果应该是true或者false,然后利用参数返回值,就是利用指针返回编号,他就写了一个方法,我找了一些方法试验了一下,下面这种可行,希望给大家一点提示吧。
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace ConsoleApplication30
记录一些有用的链接吧
/article/5137577.html
http://www.cnblogs.com/wy/articles/123656.html
http://dotnet.csdn.net/page/aab1def7-35a4-4a5f-bd18-c82879278b22
http://www.liuwu.net/post/how-to-passing-structures-and-classes-to-unmanaged-code.aspx
/article/5460252.html
http://www.blue1000.com/bkhtml/2007-12/55484.htm
http://www.cnblogs.com/songwin/articles/1329545.html
最近老是碰到问题啊,提示“无法加载 DLL“FUKeyDll.dll”: 找不到指定的模块。 (异常来自 HRESULT:0x8007007E)。”,
这个问题也被解决了,多半是因为FUKeyDll.dll调用了其他的dll文件,缺少了其他的dll文件
相关文章推荐
- c#调用c++写成的dll文件,返回char*,返回数组,用ref接收,byte[] (zz)
- c#调用c++写成的dll文件,返回char*,返回数组,用ref接收,byte[] (zz)
- Unity使用C#调用C++dll传递指针参数、接收指针返回值
- c#调用c++写成的dll文件
- C# 调用C写的DLL时 对应的char* 类型转化为 ref byte
- C# 调用C++ dll 方法返回char* 乱码
- c# 调用c++ dll文件中的bool类型解决办法
- VS2010 C#调用C++ DLL文件
- C++与C#有关对库(动态库dll,静态库.lib)文件的调用
- PB8调用使用C++与C#分别编写生成解压缩带有密码的zip压缩文件的动态链接库dll(部分内容转自互联网)
- C#调用C++写的dll文件出错问题msvcr100.dll
- C++中的PBYTE对应C#中的ref byte; char* 对应C#中的Byte[]
- c# 调用 c++ dll 参数为结构体数组指针
- C#调用C++的DLL文件
- C#调用c++封装的dll文件提示未能加载正确的程序集XXX或其某一依赖项。。。
- C# 调用C++DLL传递的bool型,返回混乱(c++为false,c#确为ture)
- C++写dll文件用C#调用
- C#调用C++DLL的小总结8---C++Dll中函数返回字符串指针
- C#调用C++Dll字符串返回为空的问题
- c#调用c++开发的dll const char* 返回值接收问题