Click here to Skip to main content
15,883,955 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a legacy C++ application using /clr calling a managed dll (written in C#)

The app uses #import to reference ADOX. The dll also references ADOX.

Everything is fine until I add a reference to my dll to the C++ project. Then I get hundreds of errors when compiling STDAFX.CPP related to msadox.tli and msadox.tlh. Some of the errors refer to interface redefinition and suchlike, others to trying to compile the tlh and tli as if they were managed code.

I've tried #pragma managed(off) around the #import without success.

In case it's relevant the #import uses the libid:... method.

I don't understand how this conflict occurs and what I can do to overcome it. Please help!
Posted
Updated 30-Sep-10 5:21am
v2

1 solution

I got round the problem by removing the dll reference from the C++ project references and using #using "my_managed.dll" in a single cpp file (the only one that refers to the dll).

Then the compiler warned me that it was unable to import some ADOX symbols from the dll because they had already been defined (by the #import ...) but because they were only warnings I could use a #pragma to turn them off and ignore them.

Now everything works! :thumbsup:
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900