第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

c ++ / cli將(托管)委托傳遞給非托管代碼

c ++ / cli將(托管)委托傳遞給非托管代碼

C++
躍然一笑 2019-10-29 13:02:29
如何將函數(shù)指針從托管C ++(C ++ / CLI)傳遞給非托管方法?我讀了幾篇文章,例如MSDN上的這篇文章,但是它描述了兩種不同的程序集,而我只想要一種。這是我的代碼:1)標頭(MyInterop.ManagedCppLib.h):#pragma onceusing namespace System;namespace MyInterop { namespace ManagedCppLib {    public ref class MyManagedClass    {    public:        void DoSomething();    };}}2)CPP代碼(MyInterop.ManagedCppLib.cpp)#include "stdafx.h"#include "MyInterop.ManagedCppLib.h"#pragma unmanagedvoid UnmanagedMethod(int a, int b, void (*sum)(const int)){    int result = a + b;    sum(result);}#pragma managedvoid MyInterop::ManagedCppLib::MyManagedClass::DoSomething(){    System::Console::WriteLine("hello from managed C++");    UnmanagedMethod(3, 7, /* ANY IDEA??? */);}我嘗試創(chuàng)建托管委托,然后嘗試使用Marshal::GetFunctionPointerForDelegatemethod,但無法編譯。
查看完整描述

2 回答

  • 2 回答
  • 0 關(guān)注
  • 591 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號