473,465 Members | 1,931 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

regasm exports unmanaged classes

Greetings

I'm using VC++.NET to create a class library. The class library
contains managed classes that wrap legacy unmanaged classes by the
same name.

I use regasm to register the DLL for COM interop.

If I don't include any managed classes in the library, the context
help in VB6 lists every single unmanaged class in the class library
(even though those classes are not declared with the public keyword.)

If I include managed classes in the class library (in addition to the
aforementioned unmanaged ones), the context help in VB6 lists only the
managed classes.

If the managed classes have the same names as the unmanaged classes,
the VB6 context help shows the class name with the library name and an
underscore prepended (eg: MyLibrary_MyClass instead of MyClass), and
as before, does not show the unmanaged ones (which seems to defeat the
purpose of resolving the name collision in this manner).

When I say "context help", I mean when I type

Dim x As MyLibrary. <-- right here, VB6 lists the available classes

When I run regasm in verbose mode, it happily declares that it is
exporting every class in the class library, including the old
unmanaged ones that are, I assume implicitly scoped as "private".

How do I tell regasm (or VC++.NET 2003 or whatever) to only export the
classes marked as public and thus, not to attempt to resolve name
collisions with underscores?

Thanks in advance.

Tony
Nov 17 '05 #1
5 1801
Added a more directly appropriate newsgroups and set follow-ups to that
newsgroup.

Ronald Laeremans
Visual C++ team

"Anthony Evans" <ae********@yahoo.com> wrote in message
news:86*************************@posting.google.co m...
Greetings

I'm using VC++.NET to create a class library. The class library
contains managed classes that wrap legacy unmanaged classes by the
same name.

I use regasm to register the DLL for COM interop.

If I don't include any managed classes in the library, the context
help in VB6 lists every single unmanaged class in the class library
(even though those classes are not declared with the public keyword.)

If I include managed classes in the class library (in addition to the
aforementioned unmanaged ones), the context help in VB6 lists only the
managed classes.

If the managed classes have the same names as the unmanaged classes,
the VB6 context help shows the class name with the library name and an
underscore prepended (eg: MyLibrary_MyClass instead of MyClass), and
as before, does not show the unmanaged ones (which seems to defeat the
purpose of resolving the name collision in this manner).

When I say "context help", I mean when I type

Dim x As MyLibrary. <-- right here, VB6 lists the available classes

When I run regasm in verbose mode, it happily declares that it is
exporting every class in the class library, including the old
unmanaged ones that are, I assume implicitly scoped as "private".

How do I tell regasm (or VC++.NET 2003 or whatever) to only export the
classes marked as public and thus, not to attempt to resolve name
collisions with underscores?

Thanks in advance.

Tony

Nov 17 '05 #2
Hello Ronald

Thank you for your efforts, however I actually posted to languages.vc
first. No one has responded to my original thread there.

Tony

"Ronald Laeremans [MSFT]" <ro*****@online.microsoft.com> wrote in message news:<er**************@tk2msftngp13.phx.gbl>...
Added a more directly appropriate newsgroups and set follow-ups to that
newsgroup.

Ronald Laeremans
Visual C++ team

"Anthony Evans" <ae********@yahoo.com> wrote in message
news:86*************************@posting.google.co m...
Greetings

I'm using VC++.NET to create a class library. The class library
contains managed classes that wrap legacy unmanaged classes by the
same name.


<snip>
Nov 17 '05 #3
I redirected this to the interop newsgroup. Which is where the experts on
this hang out., including the team that wrote regasm.

Ronald

"Anthony Evans" <ae********@yahoo.com> wrote in message
news:86*************************@posting.google.co m...
Hello Ronald

Thank you for your efforts, however I actually posted to languages.vc
first. No one has responded to my original thread there.

Tony

"Ronald Laeremans [MSFT]" <ro*****@online.microsoft.com> wrote in message
news:<er**************@tk2msftngp13.phx.gbl>...
Added a more directly appropriate newsgroups and set follow-ups to that
newsgroup.

Ronald Laeremans
Visual C++ team

"Anthony Evans" <ae********@yahoo.com> wrote in message
news:86*************************@posting.google.co m...
> Greetings
>
> I'm using VC++.NET to create a class library. The class library
> contains managed classes that wrap legacy unmanaged classes by the
> same name.
>


<snip>

Nov 17 '05 #4
I spoke with David King, a Volt contractor at Microsoft Product
Support.

He told me that this was a "known limitation of the compiler." He
suggested the following work-arounds:

1. Modify the source components to avoid creating the problem in the
first place. This is the most robust, and recommended, solution. For
example, choose sufficiently unique names for public symbols, given
the preceding information. Creating .NET components that work well
when exposed to COM clients usually involves some compromises (e.g.
anticipating the flattening of namespaces).

2. Modify client usage of the resulting library.
a) The C++ #import statement allows selective renaming of imported
symbols: #import "msrepro.dll" rename ("msrepro_Class1", "Class1")
b) VB6 (and other) clients have no such option.

3. Forego automated wrapper (interop) generation and write your own
COM-callable wrapper library. VC++ 7.1 supports mixed
managed/unmanaged code that would allow you to directly use a .NET
library from within a ‘traditional' C++ COM library, which would then
expose it's own interface to bridge COM clients to the .NET DLL.

4. Modify the exported type library. The only way to do this is to
decompile the type library to IDL, modify it (e.g. rename symbols),
and recompile. tlbexp.exe, any text editor and midl.exe may be used to
perform each of these actions, respectively.

I'll probably go with #4. I'll post back here if it doesn't work.
Nov 17 '05 #5
I spoke with David King, a Volt contractor at Microsoft Product
Support.

He told me that this was a "known limitation of the compiler." He
suggested the following work-arounds:

1. Modify the source components to avoid creating the problem in the
first place. This is the most robust, and recommended, solution. For
example, choose sufficiently unique names for public symbols, given
the preceding information. Creating .NET components that work well
when exposed to COM clients usually involves some compromises (e.g.
anticipating the flattening of namespaces).

2. Modify client usage of the resulting library.
a) The C++ #import statement allows selective renaming of imported
symbols: #import "msrepro.dll" rename ("msrepro_Class1", "Class1")
b) VB6 (and other) clients have no such option.

3. Forego automated wrapper (interop) generation and write your own
COM-callable wrapper library. VC++ 7.1 supports mixed
managed/unmanaged code that would allow you to directly use a .NET
library from within a ‘traditional' C++ COM library, which would then
expose it's own interface to bridge COM clients to the .NET DLL.

4. Modify the exported type library. The only way to do this is to
decompile the type library to IDL, modify it (e.g. rename symbols),
and recompile. tlbexp.exe, any text editor and midl.exe may be used to
perform each of these actions, respectively.

I'll probably go with #4. I'll post back here if it doesn't work.
Nov 17 '05 #6

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

Similar topics

1
by: Bob Rock | last post by:
Hello, in the last few days I've made my first few attempts at creating mixed C++ managed-unmanaged assemblies and looking aftwerwards with ILDASM at what is visible in those assemblies from a...
2
by: Bob Rock | last post by:
Hello, in the last few days I've made my first few attempts at creating mixed C++ managed-unmanaged assemblies and looking afterwards with ILDASM at what is visible in those assemblies from a...
0
by: Namratha Shah \(Nasha\) | last post by:
Hey Guys, TlbExp.exe and Regasm.exe tools aid us in exporting assembly information to a type library so that non .Net Applications or unmanaged code use this type library information to call...
6
by: marek | last post by:
Hello All, we are doing a quite a big project that contains at the lowest level an unmenaged c++ classes. Above it there are managed wrappers and at the top there are ASP.NET pages. Can anyone...
2
by: Id L | last post by:
hi, i want to use gacutil.exe and regasm.exe but i don't want to install "all" .net framework SDK do you know if i can install only these 2 methods? or maybe i can use them without installing...
6
by: Stephen Walch | last post by:
Our application environment consists of three basic layers: 1. Third-party unmanaged DLLs that were written before the CLR was invented and maintain a significant amount of information (including...
9
by: Amit Dedhia | last post by:
Hi All I have a VC++ 2005 MFC application with all classes defined as unmanaged classes. I want to write my application data in xml format. Since ADO.NET has buit in functions available for...
2
by: Jon Slaughter | last post by:
How difficult is it for one to integrate unmanaged C++ into C#? I know for functions one can use DLLimport but how does one go about doing it for classes? Do I have to completely reimplement the...
5
by: ttc | last post by:
Hi All, I have a managed class that inherits from an unmanged class. The question is, if the object of the manged class get garbage collected, will the memory be free automatically for me or...
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
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...
1
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
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
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...
0
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...

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.