c++-cli

C++/CLI enum not showing up in C# with reference to C++/CLI project

心不动则不痛 提交于 2019-12-22 03:19:29
问题 I can't get the contents of an C++/CLI enum to show up in a C# project. I can see inside a class I wrote, and even see the enum, but I can't see the enum values. So I can't use the thing on my C# side. Any reason why contents of a C++/CLI enum wouldn't show up. My C++/CLI project is compiled as mixed to reuse a C++ library. And I'm using Visual Studio 2005. 回答1: Make sure you used enum class to create a .NET-compatible enumeration, and not a native C++ enum type. Later versions of Visual C++

Looking for a faster-than-GDI solution for rendering dynamic data plots

流过昼夜 提交于 2019-12-21 22:34:23
问题 I've written a simple GDI-based data plotter using C++/CLI but it's not particularly fast (some basic profiling indicates it's the rendering to screen that's the problem). Is there any way to enable hardware acceleration for a UserControl or is there a .net interface for direct3D? ...or are there some other options I could consider. We're using managed code so the solution really needs to be CLI compatible if at all possible. [Edit] In case it helps, I'm rending strips (128 data points) of

Capturing stdout from unmanaged DLL in C# caller

二次信任 提交于 2019-12-21 21:46:31
问题 I have a C# application calling a native C++ DLL via some C++/CLI marshalling code: C# --> C++/CLI --> C++ (no CLR) I want the DLL to post string updates back to the calling application while it is running. Currently the unmanaged DLL writes output to stdout. Essentially I need to capture this output in the UI. In other cases where I am shelling an unmanaged exe this can be achieved by simply redirecting stdout from the callee to a string buffer in the UI data bound to a text panel. I do not

Marshalling C++ pointer interface back though C# function call in a non default AppDomain

懵懂的女人 提交于 2019-12-21 20:44:18
问题 I have a working CLI interface between C++ and C# code. The code has a C++ abstract interface like: -------------C++ Interface--------------- namespace cppns { class cppInterface { public: virtual bool Start(const char *pcDir) = 0; }; } ------Implementation of abstract C++ interface in same dll--------- namespace cppns { class cppimp : public cppInterface private: gcroot<MyInternalCSharpClass^> mInternalClassAccess; public: cppimp::cppimp() { mInternalClassAccess = gcnew MyInternalCSharpClass

Stack overflow in c# app using c++ dll

☆樱花仙子☆ 提交于 2019-12-21 16:57:08
问题 I've got a c# program which is using a c++/cli managed dll. The dll contains a lot of legacy code, consisting of quite a few win32 windows. Problem is, the windows in the dll need a bit more stackspace than average cough . Since these are not background processes but win32 api I need to enlarge the stack size of the GUI thread (at least I think the win32 api in the dll will use the main gui process). So I need a way to enlarge the size of the GUI thread in a c# process. Since I found no

Use C++ CLI template class in C#

爱⌒轻易说出口 提交于 2019-12-21 09:32:18
问题 I have the following class in C++/CLI and an explicit template instantiation for the int primitive.. template<typename T> public ref class Number { T _value; public: static property T MinValue { T get() { return T::MinValue; } } static property T MaxValue { T get() { return T::MaxValue; } } property T Value { T get() { return _value; } void set(T value) { if( value<MinValue || value > MaxValue) throw gcnew System::ArgumentException("Value out of range"); _value = value; } } }; template ref

Use C++ CLI template class in C#

久未见 提交于 2019-12-21 09:31:21
问题 I have the following class in C++/CLI and an explicit template instantiation for the int primitive.. template<typename T> public ref class Number { T _value; public: static property T MinValue { T get() { return T::MinValue; } } static property T MaxValue { T get() { return T::MaxValue; } } property T Value { T get() { return _value; } void set(T value) { if( value<MinValue || value > MaxValue) throw gcnew System::ArgumentException("Value out of range"); _value = value; } } }; template ref

Pass an argument to task in C++/CLI?

耗尽温柔 提交于 2019-12-21 07:49:26
问题 I have this code for the C# in Visual Studio 2012. public Task SwitchLaserAsync(bool on) { return Task.Run(new Action(() => SwitchLaser(on))); } This will execute SwitchLaser method (public nonstatic member of a class MyClass ) as a task with argument bool on. I would like to do something similar in managed C++/CLI. But I am not able to find out any way how to run a task, which will execute a member method taking one parameter. Current solution is like this: Task^ MyClass::SwitchLaserAsync(

LNK1318: Unexpected PDB error; OK (0)

风流意气都作罢 提交于 2019-12-21 07:22:05
问题 I'm trying to link against a library (libcef_wrapper_dll.lib) that was built with the /MDd flag. My application is build with /MDd and /CLR so should be compatible. The project compiles fine but when linking I get the very unhelpful error below: Error 1 fatal error LNK1318: Unexpected PDB error; OK (0) '' c:\Projects\Cef\CefSharp\libcef_dll_wrapper.lib 1 CefSharp I don't have a .PDB file for the .LIB, do I need one? 回答1: Turned out that I needed to delete all of the project temp files inc.

Could C++.Net assemblies be decompiled easily?

南笙酒味 提交于 2019-12-21 05:32:06
问题 I know that all assemblies can be decompiled somehow, but C# & VB applications are the easiest to be decompiled into source code using tools like ( .Net Reflector ). So my question is, if I programmed an application using .Net assemblies and functions with C++, would it be easy to decompile it as if it was a C# or VB application with .Net reflector and such tools? Ok, if I programmed it without using any function from .Net framework and made UI only what calls .Net assemblies, would be easy