|
-
November 24th, 2004, 04:54 AM
#1
Wrapping unmanaged C++
Hello,
I have a huge set of unmanaged C++ classes, which I wrapped in managed C++.
Everything is in one assembly.
Using my wrapper in C# works fine.
However, when I would like to use the wrapper in managed C++ I get the
following warnings and errors:
warning C4945: 'MyType' : cannot import symbol from 'mydll.dll': as
'MyNamespace::MyType' has already been imported from another assembly
'mydll.dll'
stdafx.cpp(0) : see declaration of 'MyNamespace::MyType' first seen type is
used; re-order imported assemblies to use the current type
(Is this caused by forward declarations?)
And:
error C3635: 'MyUnmanagedNamespace::MyUnmanagedType': undefined native type
used in 'MyNamespace::MyType'; imported native types must be defined in the
importing source code
did you forget to include a header file?
My questions:
How can I solve these problems WITHOUT having to include my unmanaged header
files in the project that uses my assembly? I am not using any unmanaged
stuff, so why would I like to include anything?
I want to re-use the code at binary level only.
Greets,
Arthur
-
November 25th, 2004, 11:26 AM
#2
Re: Wrapping unmanaged C++
How are you trying to reference your dll ?
Have you tried
Code:
#using "name of dll.dll"
instead of adding it to the references list ?
Darwen.
-
November 25th, 2004, 11:55 AM
#3
Re: Wrapping unmanaged C++
I do both...
The only solution I can think of is to dump all of the header files of my unmanaged library in "uncludeallunmanaged.h", and link the lib of the unmanaged library with my project. I don't want to let the users of this managed dll think about what unmanaged stuff they need to include...
-
December 3rd, 2004, 08:23 PM
#4
Re: Wrapping unmanaged C++
Doing both is your problem. You need to do only one or the other. If you put the dll in your references and also put a #using statement, it tries to import the dll twice. (it's different than in C#)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|