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

E

Ekim

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.
 
H

Howard

Ekim said:
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.

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
 
P

Peter Koch Larsen

Ekim said:
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
 
D

David Harmon

On Thu, 9 Sep 2004 19:42:05 +0200 in comp.lang.c++, "Ekim"
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
 
U

Unforgiven

Ekim said:
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
 
U

Unforgiven

David Harmon said:
On Thu, 9 Sep 2004 19:42:05 +0200 in comp.lang.c++, "Ekim"


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
 
E

Ekim

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!
 
J

Jeff Flinn

Ekim said:
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
 

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

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top