Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / October 2004

Tip: Looking for answers? Try searching our database.

VC++ COM-library compilation under .NET as managed code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michael Braitmaier - 10 Oct 2004 11:02 GMT
I have a quite severe problem. I am trying to compile a C++ library
initially written for VC++ 6. To make the library available for .NET
languages I want to compile the library as managed C++ library. As the
library is utilizing DirectX 9 it bases on COM. This causes me quite some
troubles as I get compile errors caused by the include files included
through the DirectX 9 header file.
The errors occur in unknwn.h, objbase.h and ObjIdl.h.

For example:
    Error     12          error C2079: 'IRpcStubBuffer' uses undefined
struct 'IRpcStubBuffer'     I:\Programme\Microsoft SDK\include\ObjBase.h
398
    Error     11          error C2146: syntax error : missing ';' before
identifier 'IRpcStubBuffer'     I:\Programme\Microsoft SDK\include\ObjBase.h
398

    Error     19          error C2146: syntax error : missing ';' before
identifier 'IClassFactory'     I:\Programme\Microsoft SDK\include\Unknwn.h
60
    Error     17          error C2146: syntax error : missing ';' before
identifier 'AsyncIUnknown'     I:\Programme\Microsoft SDK\include\Unknwn.h
54
    Error     15          error C2146: syntax error : missing ';' before
identifier 'IUnknown'     I:\Programme\Microsoft SDK\include\Unknwn.h     48

    Error     116          error C2146: syntax error : missing ';' before
identifier 'IMarshal2'     I:\Programme\Microsoft SDK\include\ObjIdl.h
54
    Error     114          error C2146: syntax error : missing ';' before
identifier 'IMarshal'     I:\Programme\Microsoft SDK\include\ObjIdl.h     48

Overall the compiler throws about 200 error messages. I am compiling against
the include files contained in the VS.2005 Beta.
Strangely enough I once got it compiled under VS.NET 2002, but then I
missed generics which were not available then, which I hope work with VS2005
now. If someone could point me out a direction where to investigate for or
have an idea about how to solve this problem, that would be great.
Any help would be greatly appreciated.

Michael
Carl Daniel [VC++ MVP] - 10 Oct 2004 14:40 GMT
> I have a quite severe problem. I am trying to compile a C++ library
> initially written for VC++ 6. To make the library available for .NET
[quoted text clipped - 3 lines]
> included through the DirectX 9 header file.
> The errors occur in unknwn.h, objbase.h and ObjIdl.h.

The first thing to check is the order of the include directories.  Make sure
that the DX9 directory appears first, followed by a current PSDK, followed
by the VC++ directories.  Usually that's all it takes when errors are
showing up in COM platform headers.

-cd
Michael Braitmaier - 12 Oct 2004 08:30 GMT
I did as you said. Ordered the include directories according to your answer,
but still I have the same problems.
Possibly I might miss some compiler option to set? Initially I just took the
C++ library created a .NET project, compiled it in standard C++ first which
worked and then activated the /CLR switch to enable managed C++.
I deactivated library internally used code parts by using "#pragma
unmanaged".
Do I have to activate something else considering COM compatibility under
managed C++?

Thanks so far.
Michael

>> I have a quite severe problem. I am trying to compile a C++ library
>> initially written for VC++ 6. To make the library available for .NET
[quoted text clipped - 10 lines]
>
> -cd

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.