473,625 Members | 3,330 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 2444

"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.publi c.dotnet.langua ges.vc

--
Unforgiven

Jul 22 '05 #5
"David Harmon" <so****@netcom. com.invalid> wrote in message
news:41******** ********@news.e ast.earthlink.n et...
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.publi c.dotnet.langua ges.vc

Jeff
Jul 22 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
4502
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 problem and the potential for deadlocks. After pouring over the available information, and trying a few experiments, I am still left with a few questions and issues I hope someone out there can shed some light on.
1
1321
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 code looks like this: double** arr = new double*;
2
1905
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. See code below: Object __gc* memberAttributes = info->GetCustomAttributes(__typeof(EntryPointAttribute), false);
1
2424
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 HRESULT: 0x80131019. at System.Reflection.Assembly.nLoadImage(Byte rawAssembly, Byte rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark) at System.AppDomain.Load(Byte rawAssembly) ...
0
1602
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 that when I ran it and looked at memory usage (in Windows task manager) it looked as if there was a very slow leak. To isolate the issue:
1
1255
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 I make. In other words, it isn't actually calling the native method directly, right? So, when I create a variable based on a struct (such as POINT or COORD) in my Managed class, I can't just pass it in to the API call, right? It seems that...
12
2528
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 MC++. Please guide me on this. thanks in advance, Abin
8
2197
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 existing code. The options I've considered so far: 1. Create a new MC++ GUI project and add the *.c files to them and mark them with pragma unamanged. However, the /clr option does not compile *.c files, so I rename them to *.cpp, and now they...
8
1637
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. Actually, the first release of this 'port' is be a simple rebuild of the unmanaged C++ SDK in VS.NET. I have done this part already, using VS.NET 2003.
0
8256
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8635
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8356
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6118
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4089
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4193
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2621
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 we have to send another system
1
1803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1500
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.