I'm creating a WinForms program with a combination of native and managed code. When I compile the program with /clr:pure it builds and runs without problems. I'd like to use the Boost Filesystem library, but the linker complains about undefined references when /clr:pure is on. Using only /clr, the program builds fine, but when trying to run, an exception gets thrown.
The exception gets triggered by line 1473 of dbgheap.c (part of the VC runtime): _ASSERTE(_CrtIsValidHeapPointer(pUserData));
NOTE: This only happens when using the /clr switch. It doesn't happen with /clr:pure, for example. Can anyone shed some light on this? I'm using VS.NET 2005 Prof SP1 on WinXP Prof SP2 on x86 platform.
Sorry I wasn't able to respond sooner, but you know how deadlines are. Anyway, I worked around the problem by using the file & directory manipulation classes in the System::IO namespace. I'd still like to investigate this problem further when I find some time though.
I'm trying to use Jeff Atwood's Encryption class, but replicating a simple example yields lots of errors at compile time. Jeff's class is written in VB.NET, but AFAIK all .NET languages compile down to the same CIL, right? So I should be able to use it.
I've tried to rewrite the following VB.NET code in C++/CLI. Am I doing something wrong?
Dim sym As New Encryption.Symmetric(Encryption.Symmetric.Provider.Rijndael)<br />
Dim key As New Encryption.Data("My Password")<br />
Dim encryptedData As Encryption.Data<br />
encryptedData = sym.Encrypt(New Encryption.Data("Secret Sauce"), key)<br />
Dim base64EncryptedString asString = encryptedData.ToBase64<br />
I've compiled Jeff's code into a DLL assembly, and I'm trying to use the encryption classes from the assembly. The problem is that when I try to create an Encryption::Symmetric object, the compiler says:
error C3673: 'EncryptionClassLibrary::Encryption::Symmetric' : class does not have a copy-constructor
Christian Graus wrote:
Or use something in the Cryptography namespace ?
IMO Jeff's Encryption class is a lot simpler to use than the stuff in System::Security::Cryptography. But if I can't figure out how to get it working, I guess I'll have to use the latter.
As far as I know, you cannot create copy constructors in VB.NET. It is possible a GC object may have been created on the stack (You have a missing "^" and "gcnew" somewhere!) when the code was converted from VB.NET.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
I don't have VB.NET installed (untick it out of habit) - but I looked at the VB code and it looks like the constructor's first argument is specified as By Val. Try de-referecing the handle and pass that - it may not work, but worth a try :-