本文介绍了如何使用TProactor实施通知机制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果使用Proactor,则可以使用混合"模式来推送方法.但是我们不能将其与TProactor一起使用吗?

反应堆:

If we used Proactor,we can use Mixed mode to push an method. But We can''t use it with TProactor?

Reactor:

int register_handler (ACE_Event_Handler *event_handler,
                       ACE_HANDLE event_handle = ACE_INVALID_HANDLE);


前驱者:


Proactor:

ACE_Proactor_Impl : public ACE_Event_Handler




TProactor




TProactor

TRB_Proactor_Impl

//不继承!!!

推荐答案

#pragma managed(push,off)
 // Unmanaged code goes here
#pragma managed(pop)



ACE.dll是不受管的,并且对托管代码一无所知.您应该将ACE框架中的类派生的类实现为非托管代码.这不会阻止您从非托管代码中调用托管代码-因为您将项目编译为混合模式程序集,而VC ++可以执行它的魔术" :)

看看将ACE与C ++ CLI一起使用 [ ^ ],以获取有关如何集成ACE和C ++ CLI混合模式的示例.

问候
Espen Harlinn



ACE.dll is unmanaged, and knows nothing about managed code. You should implement classes derived from classes in the ACE framework as unmanaged code. That does not prevent you from calling managed code from your unmanaged code - because you are compiling your project as a mixed mode assembly and VC++ can then perform it''s "magic" :)

Take a look at Using ACE with C++ CLI[^] for an example of how to integrate ACE and C++ CLI Mixed mode.

Regards
Espen Harlinn


这篇关于如何使用TProactor实施通知机制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 18:55