Problem using mixed-mode DLL from VB.NET

D

Doug Belkofer

We have created a fairly complex mixed-mode DLL that we want to use from
VB.NET. The mixed-mode DLL is written in C++, and does use the standard C
runtime libraries. An unusual thing is happening in that when we look at
this DLL from the Object Browser in Visual Studio, it seems to be exporting
several items related to the standard C runtime libraries. One example is
that there is a namespace called "std" in the Object Browser, and in that is
something the Object Browser identifies as "Public Structure exception".

If we have code somewhere in the VB.NET application that throws an
exception, and such as:

Throw New exception("FOO")
We get a build error that says "Type 'exception' has no constructors." The
mixed mode DLL is obviously making something visible to the project with the
name "exception", even though we never intended to do that. In fact, there
are many things showing up in the Object Browser for this mixed mode DLL
that should not be showing up.

If we modify the code to say:

Throw New System.Exception("FOO")

then everything works fine. But we don't want to have to deal with these
naming conflicts, because the names in the mixed mode DLL shouldn't be
visible in the first place.

Does anyone have any ideas on how to fix this?
 
A

Armin Zingler

Doug Belkofer said:
then everything works fine. But we don't want to have to deal with
these naming conflicts, because the names in the mixed mode DLL
shouldn't be visible in the first place.

This sounds like you want to change the DLL written in C++. The better group
for this is microsoft.public.dotnet.languages.vc


Armin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top