When programming a small OpenGL application using Windows Forms, I discovered something using a profiler that I thought was pretty wonky.
I'm using a System::Windows::Forms::Timer to detect a combination of mouse idling and some other user input. The tick functionality is useful, but on occasion I want to 'reset' the timer. You can't r...
What is the difference between the 'delete' and 'dispose' C++ operators with regards to dynamic memory allocation?
...
Is there a may to make a managed C++ class "internal"? I.E. What is the equivalent of "internal class" in managed C++?
...
I have a non-.NET C++ class as follows:
Foo.h:
namespace foo {
const static std::string FOO;
...
}
Foo.cc:
using namespace foo;
const std::string FOO = "foo";
I want to expose this for use in a C# application, but I keep getting errors about mixed types when I try the following:
FooManaged.h:
namespace foo {
namespace NET...
I am creating a wrapper around a native lib, which comes in both 32 & 64 bit flavors. I have a fairly complex C++/CLR project that includes a number of header files from the native libs. I got it to work fine on x32, but now I'm not sure how to provide an alternative x64 build.
Can someone outline the steps to create such project?
Var...
Is it possible to make this work?
template<class T>
fun(T * t) { t->someMemberFunc(); }
... somewhere in the code:
ManagedType ^ managedP = gcnew ManagedType();
UnmanagedType * unmanagedP = new UnmanagedType();
fun(managedP);
...
What is the difference between a handle to an object in Managed C++
such as:
System::String^ str = gcnew System::String();
and the ordinary C++ pointers?
Also how do they relate to references we have in C#?
...
I have a C# .Net console application which calls a C++ .Net class library. However, when the following application is executed, the list becomes empty!!!
If I remove the line as indicated in the comment next to it, the code works. I don't understand the reason for this.
If I want to reallocate the memory for list in the C++ class libr...
In my experience, .net is 2 to 3 times slower than native code. (I implemented L-BFGS for multivariate optimization).
I have traced the ads on stackoverflow to
http://www.centerspace.net/products/
the speed is really amazing, the speed is close to native code. How can they do that?
They said that:
Q. Is NMath "pure" .NET?
A. The ans...
My whole application (which is rather big, with a 20MB executable) is written in unmanaged C++.
Because I can clearly see the advantages in using managed code, I want to start introducing managed code in my application, but where do I start?
Can I easily start to use C++/CLI and link it with the rest of my application? (although the C++...
is this file with namespace Gdiplus in c++ managed or unmanaged code?
...
My managed c++ code fails to compile with the error message
.\Window.cpp(11) : error C2440: 'initializing' : cannot convert from 'System::Windows::Forms::Form ^' to 'Enviroment::Window ^'
No user-defined-conversion operator available, or
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast o...
Could someone point me whats wrong with this code please? I'm having a very hard experience in mixing C++ and MC++. I have read a lot of blogs and tutorial regarding this subject (passing delegates) but now that looks my code is ok (its compiling and runs well when in debug mode and step by step) it crashs.
The main problem is that it n...
hi,
I have a callback that is called through a delegate. Inside it I will need to treat the buffer data that arrive from a record procedure. Normaly in a unmanaged context I could do a reinterpret_cast on dwParam1 to get the object reference.
But in a manged context how can I cast a DWORD_PTR to a managed object ref?
static void Wav...
UPDATE:
I thought it was Windsows.h i need to include and you have confirmed this, but when i do include it i get a bunch of messages like the following...
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(5934) : error C2872: 'IDataObject' : ambiguous symbol
1> could be 'C:\Program Files\Microsoft SDKs\Windows\v6....
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(5934) : error C2872: 'IDataObject' : ambiguous symbol
1> could be 'C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(251) : System::Windows::Forms::IDataObject IDataObject'
1> or 'c:\windows\microsoft.net\framework\v2.0.50727\system.windows....
Is it possible to throw exceptions in an unmanaged DLL and handle it in a managed application?
My unmanaged C++ DLL throws exceptions in case of errors, and they should be handled in the calling executable application.
CMyFileException *x = new CMyFileException;
throw(x);
This previously worked, but now the application is compiled w...
I have a renderer written in C++ and directX. I now want to write a (level / scene / UI) editor and if possible / realistic I would prefer to write the interface to my editor in C#/.net
Is this at all feasible, without going down a route of managed c++? Can I expose the necessary interface from my renderer to a C# app, without managed...
The major advantage I see for using C++ instead of C# is compiling to native code, so we get better performance. C# is easier, but compiles to managed code.
Why would anyone use managed C++ for? What advantages it gives us?
...
I have a class implemented in C++ that's responsible for the arithmetic computation of the program, and an interface using WPF. I process the input with C# but then how can I use my C++ class?
I've seen some comments about making a managed C++ wrapper class to interact with it, but I don't know where to start. Nor do I know how I'd go t...