473,404 Members | 2,195 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

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 1390
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*********@regaldecision.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
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...
10
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...
3
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 ...
3
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...
3
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
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
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 ...
13
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...
1
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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
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,...
0
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...
0
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
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,...
0
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...

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.