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 / Languages / Managed C++ / September 2007

Tip: Looking for answers? Try searching our database.

native/managed

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dragonslayer008@hotmail.com - 17 Sep 2007 17:37 GMT
I recently added some new code files to a C++/CLI project.  The added
code is all native.  I simply added the code to the project and built
it.  It compiled fine but I am getting the linker error:

LNK2022: metadata operation failed (8013118D) : Inconsistent layout
information in duplicated types (IDirect3DDevice9): (0x0200015b)

I get this in three .obj files.  Each file has a different class, but
each class holds a member to an IDirect3DDevice9 pointer.  But I'm not
sure why this throws a LNK2022 error, which seems to have to do with
defining classes of the same name.
dragonslayer008@hotmail.com - 17 Sep 2007 17:57 GMT
I seem to have found the situation that may be causing these.

As said, the native classes have IDirect3DDevice9* data members.  A
managed ref class also has an IDirect3DDevice9* data member.  It seems
the compiler does not like this, because if I remove the
IDirect3DDevice9* data member from the managed class, the linker
errors go away.  On the other hand, this worked fine before I added
the native classes.  So can you not have instances of the same type in
a managed class and native class?
dragonslayer008@hotmail.com - 17 Sep 2007 18:35 GMT
Okay, I got it to work (it compiles and links) if I comment out
#include <d3dx9.h> at the top of the .h file that houses the managed
class

//#include <d3dx9.h> // works now
#include "Box.h" // Box.h #includes <d3dx9.h> too
#include <fstream>

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

... managed class definition

Can anyone explain this?
Ben Voigt [C++ MVP] - 17 Sep 2007 20:12 GMT
> Okay, I got it to work (it compiles and links) if I comment out
> #include <d3dx9.h> at the top of the .h file that houses the managed
[quoted text clipped - 14 lines]
>
> Can anyone explain this?

Apparently "Box.h" is making some #define changes that affect the windows
header files.  That's why the compiler complained, because the #define
values used for IDirect3DWhatever were different in different source files.

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.