Giter Site home page Giter Site logo

cpp-dll-demo's Introduction

C#调用C++编译的 dll

非托管方式

  • 值传递
  • 指针传递
  • 结构体指针传递

注意事项:

  1. 规定好两边的函数调用方式 代码中为___stdcall
  2. C++代码与C#代码必须同时为x86 或者是x64

托管方式

目的: 有一个C++写的类(ClassA),想在C#下调用这个类, 可是C#是没有简单的像dllimport这样的方法获取非托管C++ dll里的类。 解决方法: 生成一个托管C++的dll,因为托管代码与非托管代码是不能在一个文件里混编的, 必须将ClassA用托管C++的手段封装一下,然后生成一个dll,以供C#调用

  1. 结构体传递时,需要将
  • 结构体传递

ref: url

cpp-dll-demo's People

Contributors

wanger-sjtu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.