473,804 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A native 'public class' or 'private class' in VC8

Specifying 'public class' or 'private class' for C++ class definitions
is not part of the C++ standard. In a topic in the VS 2005 docs 'How to:
Declare public and private on Native classes', it is suggested that this
syntax is supported with VC8 for interaction with CLR ref classes and
for specifying in a CLR assembly.

However in the specific C++ language documentation for native classes,
there is no mention of the possibility of prepending 'class' with either
'public' or 'private'. Furthermore where it is explained in the first
topic above there is no explanation of what it actually means for native
classes, other than the implied suggestion that it treats native classes
like ref classes in CLR assemblies as regards the 'public' and 'private'
keywords in front of a ref class.

Can anybody clear up for me whether this is supported for native classes
in CLR assemblies and what it actually means given the abysmal MSDN
documentation on it ?
Aug 5 '06 #1
2 1168
"Edward Diener" <ed************ *******@tropics oft.comwrote
However in the specific C++ language documentation for native classes,
there is no mention of the possibility of prepending 'class' with either
'public' or 'private'. Furthermore where it is explained in the first
topic above there is no explanation of what it actually means for native
classes, other than the implied suggestion that it treats native classes
like ref classes in CLR assemblies as regards the 'public' and 'private'
keywords in front of a ref class.
The compiler emits value type definitions for native classes. Note
that these specify size and alignment only and the layout is done
at the C++ compiler's discretion. I guess, that was just a convenient
way to emit code from a lowered IR.

The access specifier controls the visibility of the generated value type.

-hg
Aug 5 '06 #2
Yes, EVERY (no matter if you use #pragma managed or #pragma unmanaged)
native class ends up as a managed value type in the assembly.

"Edward Diener" <ed************ *******@tropics oft.comschrieb im
Newsbeitrag news:OC******** ********@TK2MSF TNGP06.phx.gbl. ..
Specifying 'public class' or 'private class' for C++ class definitions is
not part of the C++ standard. In a topic in the VS 2005 docs 'How to:
Declare public and private on Native classes', it is suggested that this
syntax is supported with VC8 for interaction with CLR ref classes and for
specifying in a CLR assembly.

However in the specific C++ language documentation for native classes,
there is no mention of the possibility of prepending 'class' with either
'public' or 'private'. Furthermore where it is explained in the first
topic above there is no explanation of what it actually means for native
classes, other than the implied suggestion that it treats native classes
like ref classes in CLR assemblies as regards the 'public' and 'private'
keywords in front of a ref class.

Can anybody clear up for me whether this is supported for native classes
in CLR assemblies and what it actually means given the abysmal MSDN
documentation on it ?

Aug 5 '06 #3

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

Similar topics

4
4130
by: David Kantowitz | last post by:
I am trying to wrap a native-C++ DLL in managed C++, to use in a .NET project. The native code is compiled into a DLL, and I have created a .def file that exports the mangled names of the symbols I am going to use from the wrapper library. The wrapper library has the code written that uses the native classes, and wraps them to present an equivalent of their interface for .NET.
2
2329
by: Martin Zenkel | last post by:
Dear VS Team, using the Beta 2 of VS 2005 I've encontered the following problem. Let's assume threre are three Dll's, one unmanaged and two managed. In the unmanaged we put a simple unmanged struct "A" which is exported in the usual way. The first managed assembly defines a managed class "B" using the unmanaged class "A" defined in the unmanaged Dll. This class "B" has got a public
1
1604
by: Bern McCarty | last post by:
What do you make of this? I cannot tell for sure but it almost seems as the the transition thunk to get back from the native bool method to the managed caller is looking at eax and, if any bit is set, normalizing it to 0x00000001. If it wants to normalize the value then it should only operate on the al register since that's all that the native bool method uses to hold the return value. Is this a known VC 7.1 bug? Is there a hotfix...
11
9902
by: pamelafluente | last post by:
I am doing my own PrintDialog, and have placed there a combo with the printer names, as in the PrintDialog provided by VB.NET. Here is the question: how do I open the native windows printer dialog for the current printer, so that my current PrintDocument.PrinterSettings will be set according to the User choices ? Thanks -Pamela
1
5856
by: lallous | last post by:
Hello I don't have C++/CLI 2.0 reference handy and the code below was written after long hours of research and shallow readings. From what I see, the code works and looks logical to me. Can you please review it and tell me if I overlooked something. On the other hand, can you suggest a good C++/CLI 2.0 book for starters? Code purpose: To use native EnumWindows() and have its callback handled
1
6290
by: =?Utf-8?B?RmFiaWFu?= | last post by:
Hello, I want to give multiple native classes (in different mixed mode dlls) access to a managed output window (for error messages). Therefore I wrote a native singleton with __declspec (dllexport). I get the following compiler errors: Error 224 error C3389: __declspec(dllexport) cannot be used with /clr:pure or /clr:safe Error 225 error C4394: 'ErrorHandler::instance' : per-appdomain symbol should not be marked with...
0
1347
by: Ed | last post by:
Hi, dear all, I want to wrapper the legacy C++ Template Class to be used by the C# code, so I try to wrapper the legacy C++ code into CLI/C++ code first. One problem is how to wrapper C++ template class, such as List, Queue, etc? Here is a snippet of Native Code: //Native code:
4
1673
by: rwf_20 | last post by:
I'm seeing incorrect (I think) behavior in the event of an exception thrown in a native C++ library. Basically, the stack appears to unwind correctly if the caller is native, but incorrectly if the caller is /clr. Consider the following C++ static lib: // ehTestLib.h #include <iostream> class worker { public: ~worker() { std::cerr << "~worker()\n"; }
2
2968
by: Bob Altman | last post by:
Hi all, We have a native class modeled after the System::Exception class, and all exceptions that we throw derive from this class. For now this class is quite simple: just Description and InnerException public members. One of these days I'll dig into how to implement a StackTrace property (I assume that this is possible using something like dbghelp.dll, but I've never had the time to look into it). I've recently written a managed...
0
9712
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
9594
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10595
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10343
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
10341
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
7634
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
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4308
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
3
3001
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.