Can someone please explain me the following code snippet?
value struct ValueStruct {
int x;
};
void SetValueOne(ValueStruct% ref) {
ref.x = 1;
}
void SetValueTwo(ValueStruct ref) {
ref.x = 2;
}
void SetValueThree(ValueStruct^ ref) {
ref->x = 3;
}
ValueStruct^ first = gcnew ValueStruct;
first->x = 0;
SetValueOne(*firs...
I have a project called ManagedWrapper that is Managed C++ and builds as a DLL.
I have a second project called MyManagedTest that is Managed C++ and builds as a DLL.
When I try to include a header from ManagedWrapper in MyManagedTest, I get linker LNK2020 errors. I then add a reference to ManagedWrapper in "Frameworks and References" ...
I've uploaded a ZIP file containing both the XML file I'm trying to read and the corresponding XSD files to http://www.bonnland.de/FIBEX.zip
I'm trying to deserialize the following XML (fragment) using XmlSerializer. While doing so I get the error: (Sorry for it being German I'll give a rough translation in italics)
System.InvalidOper...
Can any one give a screen shot of how and where we can enable /clr:pure option in C++ project visual studio 2008? Please...
...
Hi all,
I've done a pretty basic class in C++/CLI using generics.
How can I check if the generic array^ equals nullptr?
generic<class T> where T: IGenericContainable
public ref class FIBEXGenericContainer abstract : AbstractFIBEXNode
{
public:
property array<T>^ Children;
public:
property T default[String^]
{
T ...
I am writing two C++/CLI assemblies. One assembly has a base class with some internal virtual methods. The other assembly is marked as friend and contains derived class.
When I try to override the internal virtual method, the compiler is forcing me to change the visibility level to public.
What is going on? Why do I have to do this?
C...
Hi guys, I am having the strangest problem...When I convert from a textbox->text into a double , I get the number .99999999991 if a zero was in the text box. Why is this? Here is my example code:
double theNumber = 0;
if( !double::TryParse( mTheText->Text, theNumber ) )
{
return false;
}
Notice that double is set to zero at the s...
I have a generic items list class to create a more specific listing using it as base class, something like this..
ref class ItemBase { }
ref class ItemA : ItemBase { }
ref class ItemList abstract {
public:
virtual void add(ItemBase ^p);
}
ref class ItemListA : ItemList {
public:
virtual void add(ItemA ^p) override; // it doesn't w...
How can we translate this C# code:
Mesh m7 = new Mesh();
m7.MakeFace(new ICurve[] {(ICurve) redLp },
new ICurve[][] { new ICurve[] { circle } }, Plane.XY, tol, true);
To Managed C++?
Thanks!
...
I'm new to C++/CLI, so please bear with me...
I'm working on a mixed C++/CLI DLL, which should act as a bridge between a Win32 process and a .NET assembly. In the DLL, I need some .NET stuff to be present during the lifespan of the DLL. Initializing is not that big a problem, but I couldn't figure out when can I safely cleanup the .NET ...
Hello,
From a managed c++ function I want to invoke an unmanaged function that expects a 'const char *' as an argument.
Are a) and b) below correct? For b), do I need to pin_ptr 'hello'? What about a)? Thanks.
a)
myFunction( "hello" );
b)
char hello[10] ;
strcpy( hello, "hello" );
myFunction( hello );
...
Possible Duplicate:
What is the best way to convert between char* and System::String in C++/CLI
Hello,
I have a function in a c++ project using \clr something like:
int WINAPI dmtTest(char *pcertificate)
{
String^ sCertificate;
sCertificate = pcertificate; // how can I assign pcertificate to sCertificate?
...
Hello,
I need to generate structs and classes at run time in C#(might be in CLI) managed environment.
Suppose I have all data and all data types associated with those data memebers of some class/struct. Now I need to generate structs/classes at runtime and after that I need to map data inside those runtime created structs fields.
e.g I...
I come from a .NET background and will be going into the field of rendering / graphics using OpenGL/DirectX. For this purpose C++ will be my language of choice to interact with these rendering frameworks.
As I understand it Visual C++ allows native support for CLI which is an extension to C++ that allows the application to benefit from ...
I am trying to pass an array of ints from C# to C++/CLI. Here's my code:
// SafeArrayTesting_PlusPlus.cpp
#include "stdafx.h"
#include <comdef.h>
using namespace System;
namespace SafeArrayTesting_PlusPlus
{
public ref class MyCppClass
{
public:
MyCppClass();
~MyCppClass();
...
Hello!
I am doing a bit of research before I am going to write my own 2D (and maybe some 3D) game engine. I have made an engine before using C# and XNA but I want to go cross platform this time by making my new engine in C++ using opengl etc.
But ... I still want the fast iteration times from C# and have access to the game engine there...
I am trying to pass an array of interfaces from C# to C++/CLI. Here is the code:
// *** SafeArrayTesting_PlusPlus.cpp ***
#include "stdafx.h"
#include <comdef.h>
using namespace System;
using namespace System::Runtime::InteropServices;
namespace SafeArrayTesting_PlusPlus {
public ref class MyCppClass
{
public:
M...
WPF applications are, at its core, managed applications? Right? So, I have to choose between using managed C++ or managed C#. I experimented with managed C++ years ago. It seemed to be not quite be ready for primetime. I'm guessing Microsoft has put more effort into managed C# than managed C++. So, it seems like using managed C# is...
Hi,
I am getting a memory leak whenver a new RPC thread in a DCOM server (c++ DCOM server) invokes the following managed C++ method
void CToolDataClient::SetLotManagerActive(bool bLotManagerActive)
{
if( m_toolDataManager != nullptr)
{
m_toolDataManager->LotActive = bLotManagerActive;
}
}
I get the managed C++ object point...
I have a function, singleFrameEventHandler, that I wish to be called when a certain event, OnNewFrame, occurs. After doing some research, it seemed to me that functions which handle events have a void return type and take a parameter of the type that contains the event. From what I could find online, that is done like this:
Function dec...