在C#调用C++的DLL简析(二)—— 生成托管dll
来源:互联网 发布:atmega128p单片机 编辑:程序博客网 时间:2024/05/17 03:28
#pragma onceclass _declspec(dllexport) NativeClass{private: int nCount;public: NativeClass(void) { this->nCount = 0; } ~NativeClass(void) { } int GetCount(void) { return this->nCount; } void Increase(void) { this->nCount++; } void Clear(void) { this->nCount = 0; }};
// ManageClass.h#pragma once#include "NativeClass.h"using namespace System;namespace ManageClass { public ref class NativeClassEx { // TODO: 在此处添加此类的方法。 private: NativeClass * m_pnClass; public: NativeClassEx(void) { this->m_pnClass = new NativeClass(); } ~NativeClassEx(void) { delete this->m_pnClass; } int GetCount(void) { return this->m_pnClass->GetCount(); } void Increase(void) { this->m_pnClass->Increase(); } void Clear(void) { this->m_pnClass->Clear(); } protected: !NativeClassEx(void) { delete this->m_pnClass; } };}
NativeClassEx testCalss = new NativeClassEx();Debug.WriteLine("GetCount : " + testCalss.GetCount().ToString());testCalss.Increase();testCalss.Increase();testCalss.Increase();Debug.WriteLine("GetCount : " + testCalss.GetCount().ToString());testCalss.Clear();Debug.WriteLine("GetCount : " + testCalss.GetCount().ToString());
0 1
- 在C#调用C++的DLL简析(二)—— 生成托管dll
- 在C#调用C++的DLL简析(一)——生成非托管dll
- 在C#调用C++的DLL简析(一)——生成非托管dll
- C#调用C++ DLL简析(二)—— 生成托管dll
- C#调用C++ DLL简析(一)——生成非托管dll
- 在VS2010上使用C#调用非托管C++生成的DLL文件(图文讲解)
- 在VS2010上使用C#调用非托管C++生成的DLL文件(图文讲解)
- 在VS2010上使用C#调用非托管C++生成的DLL文件(图文讲解)
- 在VS2010上使用C#调用非托管C++生成的DLL文件(图文讲解)
- 在VS2010上使用C#调用非托管C++生成的DLL文件(图文讲解)
- 在VS2010上使用C#调用非托管C++生成的DLL文件(图文讲解)
- 在VS2010上使用C#调用非托管C++生成的DLL文件(图文讲解)
- 在VS2010上使用C#调用非托管C++生成的DLL文件(图文讲解)
- 在VS2010上使用C#调用非托管C++生成的DLL文件(图文讲解)
- 在VS2010上使用C#调用非托管C++生成的DLL文件(图文讲解)
- 在VS2010上使用C#调用非托管C++生成的DLL文件(图文讲解)
- 在VS2010上使用C#调用非托管C++生成的DLL文件(图文讲解)
- c#调用非托管C++生成的dll
- 字符串匹配算法之Sunday算法
- 可变字符串由StringBuffer类和StringBuilder类来管理
- 几种内部排序算法总结!(冒泡排序、快速排序、直接插入排序、拆半插入排序、简单选择排序)
- 遮罩层
- 堆排序算法总结!
- 在C#调用C++的DLL简析(二)—— 生成托管dll
- pthread_mutex_t封装
- OpenGL学习(八) 纹理初步
- 链表C++实现
- unity3d Camera.SetReplacementShader的用法.
- 一个简单的TCP客户端程序流程
- telnet操作memcached增删改查
- Struts2 学习记录(4)
- 在Linux与Winodws下编译boost