0
点赞
收藏
分享

微信扫一扫

UWP C# 调用 C++/CX

创建一个UWP项目

UWP C# 调用 C++/CX_Test

然后创建一个通用C++运行时项目

UWP C# 调用 C++/CX_Test_02

右键点击C++项目,添加一个C++类

UWP C# 调用 C++/CX_#include_03

 

头文件.h

--------------------------------------------

#pragma once
namespace Test
{
	  public ref class MyMath sealed
	  {
	    public:
		      int add(int a, int b);
	  };
}

源文件.cpp

-------------------------------------------------------------------------------------

#include "pch.h"
#include "MyMath.h"namespace Test
{	  int MyMath::add(int a, int b)
	  {
		    return a + b;
	  }}

 

uwp C#项目的引用

------------------------------------------------------------------------

MyMath math = new MyMath();
            this.sum.Text = math.add(200, 300).ToString();

UWP C# 调用 C++/CX_右键_04

 



举报

相关推荐

0 条评论