470,596 Members | 1,356 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,596 developers. It's quick & easy.

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

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
Jul 22 '05 #1
7 2276

"Ekim" <th************@gmx.net> wrote in message
news:2q************@uni-berlin.de...
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


Jul 22 '05 #2

"Ekim" <th************@gmx.net> skrev i en meddelelse
news:2q************@uni-berlin.de...
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
Jul 22 '05 #3
On Thu, 9 Sep 2004 19:42:05 +0200 in comp.lang.c++, "Ekim"
<th************@gmx.net> 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

Jul 22 '05 #4
"Ekim" <th************@gmx.net> wrote in message
news:2q************@uni-berlin.de...
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

Jul 22 '05 #5
"David Harmon" <so****@netcom.com.invalid> wrote in message
news:41****************@news.east.earthlink.net...
On Thu, 9 Sep 2004 19:42:05 +0200 in comp.lang.c++, "Ekim"
<th************@gmx.net> 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...MCOverview.asp

C++/CLI:
http://msdn.microsoft.com/library/en.../VS05Cplus.asp

--
Unforgiven

Jul 22 '05 #6
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!
Jul 22 '05 #7

"Ekim" <th************@gmx.net> wrote in message
news:2q************@uni-berlin.de...
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
Jul 22 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Jannis Linxweiler | last post: by
2 posts views Thread by Lev | last post: by
1 post views Thread by Shawn B. | last post: by
12 posts views Thread by abintom | last post: by
8 posts views Thread by WebSnozz | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.