mixing unmanaged and managed c++ code

Discussion in 'C++' started by frank, Jan 22, 2007.

  1. frank

    frank Guest

    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
    frank, Jan 22, 2007
    #1
    1. Advertising

  2. On Jan 22, 1:50 pm, frank <> wrote:
    > Hi
    >
    > I've got aplication, which one is written in unmanaged c++ with stl,
    > i've made for it gui in managed c++.


    Sorry, but managed C++ and other extensions are off-topic in this
    group, take a look at the following page for some suggestions where you
    might better ask your question:
    http://www.parashift.com/c -faq-lite/how-to-post.html#faq-5.9

    --
    Erik Wikström
    =?iso-8859-1?q?Erik_Wikstr=F6m?=, Jan 22, 2007
    #2
    1. Advertising

  3. frank

    frank Guest

    Erik Wikström napisa³(a):
    > On Jan 22, 1:50 pm, frank <> wrote:
    >> Hi
    >>
    >> I've got aplication, which one is written in unmanaged c++ with stl,
    >> i've made for it gui in managed c++.

    >
    > Sorry, but managed C++ and other extensions are off-topic in this
    > group, take a look at the following page for some suggestions where you
    > might better ask your question:
    > http://www.parashift.com/c -faq-lite/how-to-post.html#faq-5.9
    >
    > --
    > Erik Wikström
    >

    thx, now i found microsoft.public.dotnet.languages.vc i'll post it there
    frank, Jan 22, 2007
    #3
  4. frank

    rossum Guest

    On Mon, 22 Jan 2007 13:50:45 +0100, frank <>
    wrote:

    >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
    rossum, Jan 22, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Weston Fryatt
    Replies:
    2
    Views:
    953
    Weston Fryatt
    Jan 1, 2005
  2. =?Utf-8?B?U2FuZHk=?=

    Managed and Unmanaged Code Confusion

    =?Utf-8?B?U2FuZHk=?=, Oct 26, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    525
    Kevin Spencer
    Oct 26, 2004
  3. Laurent Bugnion
    Replies:
    0
    Views:
    443
    Laurent Bugnion
    Dec 6, 2006
  4. GAH
    Replies:
    0
    Views:
    487
  5. Jürgen Tabert

    managed C++ Webservice and unmanaged code

    Jürgen Tabert, Jun 3, 2005, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    138
    Jürgen Tabert
    Jun 3, 2005
Loading...

Share This Page