简体   繁体   中英

Accessing C# Class Instances from C++ (Windows Phone 8 Direct3D)

Is there any way to access objects which have been instantiated (!) in the XAML/C#-Part of a Windows Phone 8 Direct3D Xaml/C++ App from the native side (C++)?

We tried adding the references but unfortunately had no luck with that.

Yes, first you need to define a Windows Runtime interface in your C++/CX side.

Then you can reference this interface and instantiate a C# object from a class which implements this interface.

Finally you can pass this class instance down to your C++ layer (Windows Runtime component class).

Then you are able from C++ to call methods of that WinRT interface, and your code will run in C#/.NET.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM