Discussion:
dot net library from unmanaged C++
(too old to reply)
Kenneth Porter
2010-03-04 20:01:32 UTC
Permalink
A vendor has supplied me with a DLL and .LIB of a C++ .NET wrapper around
their C API. No header file. My existing app is all unmanaged C++ with no
special MS libraries (like ATL and MFC). How do I hook this into my
existing solution?

With an unmanaged library I'd just #include the header and add the library
to the link inputs. What's the equivalent for a .NET library?
David Lowndes
2010-03-05 13:17:19 UTC
Permalink
Post by Kenneth Porter
A vendor has supplied me with a DLL and .LIB of a C++ .NET wrapper around
their C API.
My immediate thought is - why - given that you have a native
application?
Post by Kenneth Porter
No header file.
How do I hook this into my existing solution?
Using current versions of VS you'd change your project properties to
add CLR support (the /clr option), the add a reference to their
managed DLL. You can then just start using things inside the namespace
of whatever they've provided - hint... the Object Browser will list
the things you've added as a reference to your project.

Dave
Kenneth Porter
2010-03-08 02:25:27 UTC
Permalink
Post by David Lowndes
My immediate thought is - why - given that you have a native
application?
I thought it would be desirable to use their OOP packaging instead of a raw
C API. Unfortunately they don't provide a native set of classes, just .NET
ones.
Post by David Lowndes
Using current versions of VS you'd change your project properties to
add CLR support (the /clr option), the add a reference to their
managed DLL. You can then just start using things inside the namespace
of whatever they've provided - hint... the Object Browser will list
the things you've added as a reference to your project.
Thanks, I'll give that a try.
Kenneth Porter
2010-03-11 23:20:14 UTC
Permalink
Post by David Lowndes
Using current versions of VS you'd change your project properties to
add CLR support (the /clr option), the add a reference to their
managed DLL. You can then just start using things inside the namespace
of whatever they've provided - hint... the Object Browser will list
the things you've added as a reference to your project.
Ok, I attempted this and immediately my first source file dies with an
ambiguous symbol error.

I have a class MyCompany::System. All my implementation files start with
"using namespace MyCompany;". I pass System& as a parameter to a lot of
routines. As soon as I turn on /clr I get the .NET System namespace dropped
into all my sources without even adding a header for it, so I get ambiguous
symbols everywhere, and I'm forced to qualify symbols in modules that don't
use .NET. (Why didn't MS put System inside an "MS" namespace? I don't
recall Sun pushing Java library names directly into the global namespace,
but then I'm not that familiar with Java, so I don't know if MS is really
repeating a gaff already made by Sun.)

Tim Roberts
2010-03-06 23:01:49 UTC
Permalink
Post by Kenneth Porter
A vendor has supplied me with a DLL and .LIB of a C++ .NET wrapper around
their C API. No header file. My existing app is all unmanaged C++ with no
special MS libraries (like ATL and MFC). How do I hook this into my
existing solution?
If you have a .DLL and a .LIB, then you do NOT have a .NET wrapper. You
have normal unmanaged code. Managed code does not use .LIB libraries. Do
this:

dumpbin /exports xxxxx.dll

If the exports are listed, then this is just a normal C/C++ DLL.
--
Tim Roberts, ***@probo.com
Providenza & Boekelheide, Inc.
Kenneth Porter
2010-03-08 02:22:38 UTC
Permalink
Post by Tim Roberts
dumpbin /exports xxxxx.dll
If the exports are listed, then this is just a normal C/C++ DLL.
No exports, just the 3 sections .reloc, .rsrc and .text. I suspect the .lib
file is a mistake.
Loading...