473,499 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[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 2423

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
4478
by: Ted Miller | last post by:
Hi folks, I'm looking at moving a large base of C++ code to .Net under tight time constraints. The code runs in mission-critical environments, and I am extremely concerned about the loader lock...
1
1316
by: Jannis Linxweiler | last post by:
Hi guys! I'm fairly new to managed C++, so I hope someone can help me. I've got a Problem with the native C++ types. What I did is using an jagged array of double in my managed app. The...
2
1890
by: Lev | last post by:
Hi, I have some code that does reflection on an assembly I load. When I try to get the attributes on one of the methods implemented in the assembly, the MC++ version does not return anything....
1
2419
by: John | last post by:
Hi, I tried to load a mixedmode dll (MC++) with AppDomain.Load(Byte ) in a C# Client. During the Load Process I got the following Exception: System.IO.FileLoadException: Ausnahme von...
0
1585
by: Maxwell | last post by:
Hello, I recently completed a MC++ (VS2003) DLL that wraps a non MFC C++ DLL and need to use it in a MC++ Console Application (no forms/guis of any kind just output to console). Trouble is...
1
1239
by: Shawn B. | last post by:
Greetings, With a Managed class, if I'm #including a Windows SDK header file, and call an API, it appears (according to .NET Reflector) that it automatically generates a for each API call that...
12
2514
by: abintom | last post by:
hi, i am writing a dll in MC++ for using from C#. For the dll function say 'TestFunc', i need to get a SortedList<string,stringas an argument. I am not very clear about using SortedList in...
8
2176
by: WebSnozz | last post by:
I have an application written in C that does a lot of low level stuff. It does a lot of things like casting from void*'s. I want to create a new GUI for it in either C# or MC++, but reuse the...
8
1621
by: STG | last post by:
Greetings, My group has an SDK that was developed 5 years ago with VC++ 6. Over the last years, the requests for a VS.NET SDK has reached critical mass and I am now in the process of doing that....
0
7014
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7180
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7395
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5485
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4921
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3103
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.