When I'm trying serialize a class containing this property:
[NonSerialized]
property System::Collections::ObjectModel::ReadOnlyCollection<String^>^ IgnoredWords
I get a compilation error saying:
fatal error C1093: API call
'DefineCustomAttribute' failed
'0x801311c0'
How do I tell the serializer that I do not want to serializ...
I have a COM object written in managed code (C++/CLI). I am using that object in standard C++.
How do I force my COM object's destructor to be called immediately when the COM object is released? If that's not possible, call I have Release() call a MyDispose() method on my COM object?
My code to declare the object (C++/CLI):
[Gui...
I have a .NET assembly. It happens to be written in C++/CLI. I am exposing a few objects via COM. Everything is working fine, but I cannot for the life of me figure out how to return an array of my own objects from a method. Every time I do, I get a type mismatch error at runtime. I can return an array of ints or strings just fine.
...
New to VS2008...
I am using CLR Forms to create a GUI. I put a button on the form and then ask the IDE to create a click event. VS2008 puts the code in the .h file and formats it 'badly' compared to our in-house guidelines.
How do i get the code into the .cpp file and format it correctly?
Worse, when I 'reset' the event, VS2008 doe...
Say I have an array
array<double>^ buffer = gcnew array<double>(100);
And I want a function that does something like:
void foo(array<double>^% buffer)
{
Array::Resize(buffer, 10);
}
but that don't allocate and/or move &buffer[0] when you want to trim the array.
...
I want to know what is the best approach to wrapping a massive library written in C++ to make it accessible in C#.
I have done work with interop before, and I love IJW. But I am not sure of how to implement this approach with a huge library. I am wondering if there is any pattern to use, otherwise I just have to write a wrapper around...
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...
I'm trying to port some code into .net which has a load of #define'd values e.g.
#define MY_CONSTANT (512)
#define MY_VERSION_STRING "v42.2"
When I import a cli library the #define's are lost. Is there a way of defining constants in the scope of a namespace. I was thinking something like this:
namespace MyNamespace
{
const ...
I recently stumbled upon Code Contracts and have started using them in my C# projects. However, I also have a number of projects written in C++/CLI.
For C# and VB, Code Contracts offer a handy configuration panel in the project properties dialog. For a C++/CLI project, there is no such panel.
From the documentation, I got the impressio...
I suppose you cannot simply compile a C++ application with a C++/CLI compiler. I am wondering if it would be difficult. Has anybody tried this, and if so: were there a lot of modifications needed?
...
I'm working on an e-mail app in c++ using .net, and I've run into a problem I can't seem to solve. I'm trying to implement some controller classes. The top chunk is my .h file, the bottom the .cpp file. The errors I'm getting are:
'ComposeMail' : undeclared identifier
'email' : undeclared identifier
syntax error : identifier 'Compose...
Can it be defined in .h and .cpp file or it has to be defined in a single .h file?
...
I'm using Visual Studio 2008's built in testing framework in my Visual C++ project. I'm adding a new Test Project, then a new Unit Test. However, I can't use any of the functions provided by Assert. Assert shows up in the Intellisense, but I can't do anything with it. I've done unit tests fine in Visual C#. Am I forgetting to do anything...
Is anyone aware of if/when this will actually be released as hard/soft back? A draft can be downloaded from Ted Newards blog but I can't seem to find anything relating to a release date.
...
Hello everyone,
I'm currently writing a Winamp plugin framework for C# (basically, a C# implementation of the Winamp API/SDK, as well as a barebones plugin template). Because C# libraries can't export DLL entry points, I'm using a C++/CLI wrapper which basically just loads the C# library. I'd like to create a Visual Studio template for ...
How do I create a function which accepts a variable argument list in C++/CLI? I am looking to create a function which forwards most of it's arguments to String::Format.
...
C#:
char z = '\u201D';
int i = (int)z;
C++/CLI:
wchar_t z = '\u201D';
int i = (int)z;
In C# "i" becomes, just as I expect, 8221 ($201D). In C++/CLI on the other hand, it becomes 65428 ($FF94). Can some kind soul explain this to me?
EDIT: Size of wchar_t can not be of issue here, because:
C++/CLI:
wchar_t z = (wchar_t)8221;
int i = (...
I'm a bit rusty, actually really rusty with my C++. Haven't touched it since Freshman year of college so it's been a while.
Anyway, I'm doing the reverse of what most people do. Calling C# code from C++. I've done some research online and it seems like I need to create some managed C++ to form a bridge. Use __declspec(dllexport) and...
I am a newbie to C++/CLI and is having some problems trying to override the Equal method of the base Object class. I get the following compilation warning error for the following code. How should this be corrected?
Warning 1 warning C4490: 'override' : incorrect use of override specifier; 'Test::Sample::Equal' does not match a base ref ...