473,756 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Managed DLL -- Don't want all Public __gc Classes available

Using VS.net 2003 / Managed C++

I have created a base object (public __gc CBaseObject)
that everything in my project inherits from (Similar to
how everything really inherits system::Object) .
I have a Heap class that I have made into a DLL. In this
dll, I include CBaseObject (I have to dynamic cast to it
for access to some of its functions). This is made into a
dll for use in several other projects. However, when I
include (I guess #using is more like it) the dll, the
object browser lists the CHeap class (Should be there) AND
the CBaseObject class (Should NOT be there).

The problem arises when one of my projects that uses this
dll also includes CBaseObject. I get a Redefinition
error. I tried to make CBaseObject to private __gc
CBaseObject (the DLL then doesn't list CBaseObject) , but
then other
errors came up (The Heap DLL would compile fine, but when
I used it, any functions or member variables that use or
referance
CBaseObject would fail). Also, there was a warning when I
compiled the CHeap Dll (Something to the effect of can't
use private object outside of the local assembly, not sure
the exact wording).

How can I prevent CBaseObject from being available to any
projects that use the CHeap DLL?? IE, how can I control
what classes are exposed in a Managed DLL?? __Private
doesn't work, but is there something else that will??

thanks ahead

GE

PS> I am aware of the exports function for Dlls, but I am
writing a managed DLL to get away from this. I'll also
get some of the exact error messages and post them here
later.
..
Nov 17 '05 #1
1 1410
You cannot define the same type in multiple assemblies and have it work
correctly. For these types that you want to reuse you need to out them in a
separate assembly and reference that assembly whenever you need it.

Note that in the next release the compiler will give an error when you have
a private base type for a public managed type, that is illegal in practical
CLR terms.

Ronald Laeremans
Visual C++ team

"Geoff Hilyard" <gd*********@re galdecision.com > wrote in message
news:09******** *************** *****@phx.gbl.. .
Using VS.net 2003 / Managed C++

I have created a base object (public __gc CBaseObject)
that everything in my project inherits from (Similar to
how everything really inherits system::Object) .
I have a Heap class that I have made into a DLL. In this
dll, I include CBaseObject (I have to dynamic cast to it
for access to some of its functions). This is made into a
dll for use in several other projects. However, when I
include (I guess #using is more like it) the dll, the
object browser lists the CHeap class (Should be there) AND
the CBaseObject class (Should NOT be there).

The problem arises when one of my projects that uses this
dll also includes CBaseObject. I get a Redefinition
error. I tried to make CBaseObject to private __gc
CBaseObject (the DLL then doesn't list CBaseObject) , but
then other
errors came up (The Heap DLL would compile fine, but when
I used it, any functions or member variables that use or
referance
CBaseObject would fail). Also, there was a warning when I
compiled the CHeap Dll (Something to the effect of can't
use private object outside of the local assembly, not sure
the exact wording).

How can I prevent CBaseObject from being available to any
projects that use the CHeap DLL?? IE, how can I control
what classes are exposed in a Managed DLL?? __Private
doesn't work, but is there something else that will??

thanks ahead

GE

PS> I am aware of the exports function for Dlls, but I am
writing a managed DLL to get away from this. I'll also
get some of the exact error messages and post them here
later.
.

Nov 17 '05 #2

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

Similar topics

22
528
by: Alper AKCAYOZ | last post by:
Hello Esteemed Developers and Experts, I have been using Microsoft Visual C++ .NET for 1 year. During this time, I have searhed some topics over internets. Most of the topics about .NET is related to C# and Visual Basic .NET. There are less documents about Visual C++ .NET or Managed C++. I wonder the reasons of below questions: 1) Is C# more powerful than Managed C++ and Visual C++ .NET? 2) Is Microsoft intending to support C# and...
10
1649
by: Edward Diener | last post by:
The documentation states the names of the various managed operators but does not give the signature for them. Is there some documentation which I have missed that gives the correct signature ? In particular I want to implement the op_Assign (=) operator for a __value struct.
3
2218
by: mirek | last post by:
Hi, I've got problem building managed class library to wrap unmanaged code. I created managed class library using standard patten: #include "../Unmanaged/Class1.h" //Class1 unmanaged namespace ManagedWrappers { public __gc MClass1
3
4335
by: ricky_casson | last post by:
I'm attempting to create a managed C++ class from some an already existing application that I have however some of the classes allow private access via the 'friend' keyword and i've heard that this presents a problem when creating managed code. Does anyone know how i could get around this? Is it possible to still create managed code without having to make the classes managed? Moreover, what i'm trying to do is make the methods of an API,...
3
3513
by: zhphust | last post by:
I want to convert a object of a managed class to a unmanaged structure that has the same member with that managed class. Can anybody tell me how i can do it? Thanks in advance. -- zhphust ------------------------------------------------------------------------
5
1734
by: Andrew | last post by:
I want to use a managed c++ class from an unmanaged class. Here is my code: // *** Unmanaged Code // .h file class UnmanagedClass { public: // Other stuff here
3
1815
by: WithPit | last post by:
I am trying to create an managed wrapper but have some problems with it by using abstract classes. In my unmanaged library code i had the following three classes with the following hierarchy Referenced (class) Object (abstract class, inheriting from referenced) Node (class, inheriting from object)
13
5054
by: bonk | last post by:
Hello, I am trying to create a dll that internally uses managed types but exposes a plain unmanaged interface. All the managed stuff shall be "wrapped out of sight". So that I would be able to use that dll from pure unmanaged code (for example inherit from classes in that dll). Is something like that possible. I heared something called ManWarp tried that approach. If it is possible, how can I do that. Maybe there is a small litttle
1
1212
by: mschuck | last post by:
Here is the scenario I'm trying to make work. I've got 2 managed C++ classes, each of which wrappes an unmanaged C++ class, kind of like so: __nogc class UnmanagedClassA { public: void SetUnmanagedB( UnmangedClassB* val ); ....
0
9455
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
9271
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
10031
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...
1
9838
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,...
0
9708
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7242
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
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3354
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.