开发者

How to receive strings from C# in Visual-C++ based .net DLL?

开发者 https://www.devze.com 2023-01-12 08:23 出处:网络
How to receiv开发者_开发技巧e strings from C# in Visual-C++ based .net DLL? In C++ (using clr) I have this code:

How to receiv开发者_开发技巧e strings from C# in Visual-C++ based .net DLL?

In C++ (using clr) I have this code:

#include "stdafx.h"
##include <Windows.h>
#include <string>
#include <windows.h>

namespace NSST
{
  public ref class Wrapper
  {
 public:
     Wrapper() {}
    static void init_1(std::string a, std::string b){}
     static void init_2(){}
  };
};

But in .net C# I see only one function init_2. How do I make init_1 visible in .net?


You can't use std::string, you should use System::String^:

static void init_1(System::String^ a, System::String^ b);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号