mixing unmanaged and managed c++ code

F

frank

Hi

I've got aplication, which one is written in unmanaged c++ with stl,
i've made for it gui in managed c++.
Problem becomes when I'm starting to filling up for example datagrids,
when I'm adding row to datagrid , some varibles (vectors etc) in
unmanaged class are cleared or filled with null.
I want mention also when i compile only unmanaged class for console
project (without .net gui) problem never happends, everything works fine.

I've done all like in msdn example

ms-help://MS.MSDNQTR.v80.en/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_vclang/html/f072ddcc-e1ec-408a-8ce1-326ddb60e4a4.htm

my program structure looks like that

main.cpp

// gui.cpp : main project file.

#pragma managed(push, off)

#include "source\main.h"
....
#include "source\nfile.h"
#include "source\fun08.h"
....
static SCA Sca; //< --- thats my unmanaged class

#pragma managed(pop)
#include "source\guiTabPageFUN.h"
#include "source\guiTabPageN.h"
....
#include "Form1.h"

using namespace GuiNameSpace;

[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);

Application::Run(gcnew Form1(&Sca));
return 0;
}


//nfile.h:some unmanaged file

#pragma managed(push, off)

class N
{
.....int z;
}

#pragma managed(pop)

//nfile.cpp:some unmanaged file

#pragma managed(push, off)
...some functions body..
N::N()
{
int z=0;
}
#pragma managed(pop)



Is there any way to fix the problem ?

Regards
frank
 
R

rossum

I've got aplication, which one is written in unmanaged c++ with stl,
i've made for it gui in managed c++.
Managed C++ is not part of the standard. You will probably get a
better response from microsoft.public,dotnet.languages.vc where
managed C++ is on topic.

rossum
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top