[MC++] how to make global managed array?

Discussion in 'C++' started by Ekim, Sep 9, 2004.

  1. Ekim

    Ekim Guest

    hello,
    I'm using MANAGED C++ and need one of the following two questions answered:

    1.)
    How can one make a global managed array?
    I'm thinking on something like defining
    static System::Byte globalArray __gc[];
    at the begin of a file. But I get the error
    "global Array: cannot declare a global or static managed type object or
    a __gc pointer"

    anyways, is there a way to define exactly this byte array as global?
    -------------

    2.)
    Why do I always get the message
    "unresolved external symbol 'void * __cdecl operator new(unsigned int)'"
    when I try to use the new operator for an unmanaged array like this:

    static char* globalBuffer = NULL; // global variable

    void Test()
    {
    globalBuffer = new char[100]; // try to allocate memory with
    new
    }

    Do I have to "include" something to be able to use new on chars? I thought
    it should work with "It Just Works"-mechanism.
    -------------

    Thx in advance,
    ekim
     
    Ekim, Sep 9, 2004
    #1
    1. Advertising

  2. Ekim

    Howard Guest

    "Ekim" <> wrote in message
    news:...
    > hello,
    > I'm using MANAGED C++ and need one of the following two questions

    answered:
    >
    > 1.)
    > How can one make a global managed array?
    > I'm thinking on something like defining
    > static System::Byte globalArray __gc[];
    > at the begin of a file. But I get the error
    > "global Array: cannot declare a global or static managed type object

    or
    > a __gc pointer"
    >
    > anyways, is there a way to define exactly this byte array as global?
    > -------------
    >
    > 2.)
    > Why do I always get the message
    > "unresolved external symbol 'void * __cdecl operator new(unsigned

    int)'"
    > when I try to use the new operator for an unmanaged array like this:
    >
    > static char* globalBuffer = NULL; // global variable
    >
    > void Test()
    > {
    > globalBuffer = new char[100]; // try to allocate memory

    with
    > new
    > }
    >
    > Do I have to "include" something to be able to use new on chars? I thought
    > it should work with "It Just Works"-mechanism.
    > -------------
    >
    > Thx in advance,
    > ekim


    I'm just guessing what you mean here, but is "managed C++" something to do
    with Visual Studio.NET? If so, you'll need to ask on a Microsoft newsgroup.
    Check the news.microsoft.com server for available newsgroups.

    -Howard


    >
    >
     
    Howard, Sep 9, 2004
    #2
    1. Advertising

  3. "Ekim" <> skrev i en meddelelse
    news:...
    > hello,
    > I'm using MANAGED C++ and need one of the following two questions

    answered:
    [snip]

    > Thx in advance,
    > ekim
    >
    >

    I believe you should ask in a newsgroup for managed C++... doesnt Microsoft
    have one?

    /Peter
     
    Peter Koch Larsen, Sep 9, 2004
    #3
  4. Ekim

    David Harmon Guest

    On Thu, 9 Sep 2004 19:42:05 +0200 in comp.lang.c++, "Ekim"
    <> wrote,
    >hello,
    >I'm using MANAGED C++ and need one of the following two questions answered:


    What does "managed" mean? I am thinking that you should manage ALL of
    your C++ code appropriately.

    >1.)
    >How can one make a global managed array?
    >I'm thinking on something like defining
    > static System::Byte globalArray __gc[];
    >at the begin of a file.


    Again, what does "managed" mean? It has no specially defined meaning in
    C++.

    You should probably be using std::vector. Look it up!

    Do not try to declare a global array with "static". Use "extern" in the
    declaration in your common header file, and then define the array once
    in one of your C++ files.

    Otherwise, your declaration should be OK, assuming you have
    appropriately defined System::Byte somewhere. System::Byte is not a
    standard C++ type, of course.

    See also the welcome message posted twice per week in comp.lang.c++ or
    available at http://www.slack.net/~shiva/welcome.txt
     
    David Harmon, Sep 9, 2004
    #4
  5. Ekim

    Unforgiven Guest

    "Ekim" <> wrote in message
    news:...
    > hello,
    > I'm using MANAGED C++ and need one of the following two questions
    > answered:


    The Managed Extensions for C++ are off-topic in this group.

    I suggest microsoft.public.dotnet.languages.vc

    --
    Unforgiven
     
    Unforgiven, Sep 9, 2004
    #5
  6. Ekim

    Unforgiven Guest

    "David Harmon" <> wrote in message
    news:...
    > On Thu, 9 Sep 2004 19:42:05 +0200 in comp.lang.c++, "Ekim"
    > <> wrote,
    >>hello,
    >>I'm using MANAGED C++ and need one of the following two questions
    >>answered:

    >
    > What does "managed" mean? I am thinking that you should manage ALL of
    > your C++ code appropriately.


    Managed C++ in this context means "Managed by the Common Language Runtime".
    It is short for "Managed Extensions for C++" and is a set of language
    extensions to C++ to allow you to use C++ for programming for Microsoft
    ..Net. Managed C++ is also soon to be deprecated in favour of the new, ECMA
    standardized C++/CLI, which will first ship in the upcoming Visual C++ 2005.

    Managed Extensions for C++
    http://msdn.microsoft.com/library/en-us/vcmex/html/vcconMCOverview.asp

    C++/CLI:
    http://msdn.microsoft.com/library/en-us/dnvs05/html/VS05Cplus.asp

    --
    Unforgiven
     
    Unforgiven, Sep 9, 2004
    #6
  7. Ekim

    Ekim Guest

    hy,
    I apologize kindly for disturbing you - I didn't know that this newsgroup
    was only for "normal" c++.
    What's more, I couldn't find any other appropriate newsgroup.
    However, I've already solved my problem.

    By the way, because some of you asked, "managed" has something to do with
    the .NET-framework --> it works exactly the way as Mr. Unforgiven has
    described it earlier in this thread.

    Anyways,
    thx,
    ekim!
     
    Ekim, Sep 9, 2004
    #7
  8. Ekim

    Jeff Flinn Guest

    "Ekim" <> wrote in message
    news:...
    > hy,
    > I apologize kindly for disturbing you - I didn't know that this newsgroup
    > was only for "normal" c++.
    > What's more, I couldn't find any other appropriate newsgroup.


    microsoft.public.dotnet.languages.vc

    Jeff
     
    Jeff Flinn, Sep 9, 2004
    #8
    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. Trep
    Replies:
    26
    Views:
    44,953
    Karl Heinz Buchegger
    Oct 21, 2004
  2. a
    Replies:
    12
    Views:
    501
    Fredrik Lundh
    Jun 29, 2006
  3. rahulcool.bit

    how to make splash screen in managed c++

    rahulcool.bit, Nov 7, 2006, in forum: .NET
    Replies:
    0
    Views:
    1,172
    rahulcool.bit
    Nov 7, 2006
  4. /* frank */

    Array managed by preprocessor

    /* frank */, Jun 27, 2004, in forum: C Programming
    Replies:
    18
    Views:
    617
    RoSsIaCrIiLoIA
    Jul 1, 2004
  5. ben
    Replies:
    8
    Views:
    633
Loading...

Share This Page