How to create dll in C++ for using in C#

前端 未结 4 1207
失恋的感觉
失恋的感觉 2020-12-28 09:27

I\'ve a little question to ask you.

I have one C++ source and one header files. The C++ file uses windows.h library, makes operations using serial port(basic operati

4条回答
  •  情深已故
    2020-12-28 09:52

    In addition to Lichian's offer to compile to a regular DLL and use p/invoke which is probably the simplest way You can also create your C++ as a COM component (probably something you don't want to do) and the 3rd option you have is to add a thin layer of C++/CLI e.g.

    using namespace System;
    
    namespace youcomany{ namespace CPPWrapper
    {
        Wrapper::Function(String^ parameter)
        {
            //call the rest of you C++ from here
            }
    }}
    

提交回复
热议问题