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_MyCla ss 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 5 1839
Added a more directly appropriate newsgroups and set follow-ups to that
newsgroup.
Ronald Laeremans
Visual C++ team
"Anthony Evans" <ae********@yah oo.com> wrote in message
news:86******** *************** **@posting.goog le.com... 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_MyCla ss 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
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******* *******@tk2msft ngp13.phx.gbl>. .. Added a more directly appropriate newsgroups and set follow-ups to that newsgroup.
Ronald Laeremans Visual C++ team
"Anthony Evans" <ae********@yah oo.com> wrote in message news:86******** *************** **@posting.goog le.com... 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>
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********@yah oo.com> wrote in message
news:86******** *************** **@posting.goog le.com... 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******* *******@tk2msft ngp13.phx.gbl>. .. Added a more directly appropriate newsgroups and set follow-ups to that newsgroup.
Ronald Laeremans Visual C++ team
"Anthony Evans" <ae********@yah oo.com> wrote in message news:86******** *************** **@posting.goog le.com... > 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>
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.dl l" rename ("msrepro_Class 1", "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.
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.dl l" rename ("msrepro_Class 1", "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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 managed point-of-view I've noticed that:
1) for each managed and unmanaged C function (not C++ classes) I get a
public managed static method (defined on a 'Global Functions' class) in the
generated assembly with an export name of the form...
|
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 managed point-of-view
I've noticed that:
1) for each managed and unmanaged C function (not C++ classes) I get a
public managed static method (defined on a 'Global Functions' class)
in the generated assembly with an export name of the form
|
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 .Net assembly.
Just like tlbimp which works on the entire COM Component (check out
yesterdays article) tlbexp also works on the entire assembly.
The entire assembly is converted at the same time. You cannot use it to
|
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 tell me how to force ASP.NET not
to "clear" or reinitialize unmenaged global or static
variables that are set on unmanaged level between
successive requests?
|
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 SDK?
* need help also if you know how to silently install SDK?
thnx for your help
IDL
| |
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 memory
management and connection pooling constructs) as static variables which were
intended to scoped to the process.
2. Managed C++ assemblies (.NET 1.1) that wrap the unmanaged DLLs as nice
neat classes with managed interfaces.
|
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 this, I want to use
it. Is it possible to call Managed class functions from Unmanaged
class? How to do it?
I did something like this.
I declared a managed class (in C++ CLI) called as MyManagedClass whose
|
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 classes in managed C++ as a
wrapper to the unmanaged C++ classes or is there an easier way?
Essentially what I have done is written a C++ kernel mode driver and I want
to use it from my C# program. Because it requires some setup outside the...
|
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 only the bit that is used by the managed
code? What about the unmanaged bit?
Does anyone know of any article that discuss about this?
Any help is appreciated.
|
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...
|
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,...
| |
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...
|
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,...
|
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...
|
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...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
| |