c++-cli

Repeated destructor calls and tracking handles in C++/CLI

半腔热情 提交于 2019-12-28 13:51:12
问题 I'm playing around with C++/CLI, using the MSDN documentation and the ECMA standard, and Visual C++ Express 2010. What struck me was the following departure from C++: For ref classes, both the finalizer and destructor must be written so they can be executed multiple times and on objects that have not been fully constructed. I concocted a little example: #include <iostream> ref struct Foo { Foo() { std::wcout << L"Foo()\n"; } ~Foo() { std::wcout << L"~Foo()\n"; this->!Foo(); } !Foo() { std:

Repeated destructor calls and tracking handles in C++/CLI

半城伤御伤魂 提交于 2019-12-28 13:51:05
问题 I'm playing around with C++/CLI, using the MSDN documentation and the ECMA standard, and Visual C++ Express 2010. What struck me was the following departure from C++: For ref classes, both the finalizer and destructor must be written so they can be executed multiple times and on objects that have not been fully constructed. I concocted a little example: #include <iostream> ref struct Foo { Foo() { std::wcout << L"Foo()\n"; } ~Foo() { std::wcout << L"~Foo()\n"; this->!Foo(); } !Foo() { std:

Debugging C++/Cli: <Unknown function> and no Locals

一世执手 提交于 2019-12-28 04:14:26
问题 I am trying to debug a project with a C# assembly and a C++/Cli assembly. An interface defined in C# is inherited by a C++/Cli class, which in turn calls a native C++ class. Mixed-mode debugging is enabled in both C++ and C# assembly, as well as the startup .exe. Now, when I try to debug into the C++ part, it gets tricky; if I simply set breakpoints in the C++ part, they are not hit (despite the fact that I know that they are hit because logs (etc) are written and throwing an exception there

Debugging C++/Cli: <Unknown function> and no Locals

亡梦爱人 提交于 2019-12-28 04:14:05
问题 I am trying to debug a project with a C# assembly and a C++/Cli assembly. An interface defined in C# is inherited by a C++/Cli class, which in turn calls a native C++ class. Mixed-mode debugging is enabled in both C++ and C# assembly, as well as the startup .exe. Now, when I try to debug into the C++ part, it gets tricky; if I simply set breakpoints in the C++ part, they are not hit (despite the fact that I know that they are hit because logs (etc) are written and throwing an exception there

No IntelliSense for C++/CLI in Visual Studio 2010?

北城余情 提交于 2019-12-27 11:45:28
问题 I just moved from Visual Studio 2008 to Visual Studio 2010 (final) and noticed one major flaw: When I try to use AutoComplete in a C++ source file for managed C++, a small note in the footer appears: IntelliSense for C++/CLI is not available Uh, has IntelliSense for C++/CLI been dropped from Visual Studio 2010? Is there any way to get this back? It is rather useful... 回答1: You are correct. Unfortunately it has been dropped. You can check this opened issue on Microsoft's Connect website. I'll

No IntelliSense for C++/CLI in Visual Studio 2010?

女生的网名这么多〃 提交于 2019-12-27 11:45:11
问题 I just moved from Visual Studio 2008 to Visual Studio 2010 (final) and noticed one major flaw: When I try to use AutoComplete in a C++ source file for managed C++, a small note in the footer appears: IntelliSense for C++/CLI is not available Uh, has IntelliSense for C++/CLI been dropped from Visual Studio 2010? Is there any way to get this back? It is rather useful... 回答1: You are correct. Unfortunately it has been dropped. You can check this opened issue on Microsoft's Connect website. I'll

C++/cli to c++: Error s incompatible with “void (__stdcall *)(int i, std::string str)”

妖精的绣舞 提交于 2019-12-25 17:03:40
问题 I am new to C++/cli so please excuse me for silly questions or core mistakes: My C++/CLI class Library that is called by C# has only one method: ThreadsCppWrapper.h namespace namespace ThreadsCppWrapper { public ref class ThreadsCppWrapperClass { public: ThreadsCppWrapperClass(); // Constructor System::String^ mytrainOp(System::MulticastDelegate^ callbackfunction); private: MyThreadsCpp::MyThreadsCppClass* ptr; }; } ThreadsCppWrapper.cpp System::String^ ThreadsCppWrapper:

C++/CLI template wrapper round

浪子不回头ぞ 提交于 2019-12-25 09:12:27
问题 I have a set of multiple C++ classes that have the same interface (not derived from each other though). I'm trying to wrap these to make them available in .NET. I currently have a method that defines the wrapper class using C/C++ #defines and then I can subsequently instantiate classes with a simple line of code However I can't debug this. Ideally I would like to be able to use a generic or a template. However I can't use a C++ type inside a generic which would be the ultimate way to solve

Passing managed C++ arrays to and from unmanaged C

余生颓废 提交于 2019-12-25 08:51:03
问题 I am a complete beginner at C, C++ and C++/CLI, and I don't understand much about the pointers and stuff, but I really need to create a .Net wrapper around a C library. I have tried using SWIG, but it doesn't work and I'm stuck. I'd rather not use P/Invoke because there are a few nested structs involved, and I read that P/Invoke isn't great with these. So anyway, I have a C header looking like this: // packer.h typedef struct { int left; int top; int right; int bottom; } frame_t; typedef

why is “candidate function(s) not accessible” although declared public

自作多情 提交于 2019-12-25 08:25:13
问题 I am getting compile error candidate function(s) not accessible when calling certain members, although I declared them as public . I only get the error when some class from vtk is involved (as return type or as argument) and when the class to be called is not in the same VS-project as the calling code. I also tried other vtk types with no luck :( Here is some test code: // A.h, in a seperate class library #include <vtkActor.h> public ref class A { public: A(void); void test1(vtkActor* actor);