473,395 Members | 1,412 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

native/managed

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.

Sep 17 '07 #1
3 1411
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?

Sep 17 '07 #2
Okay, I got it to work (it compiles and links) if I comment out
#include <d3dx9.hat the top of the .h file that houses the managed
class

//#include <d3dx9.h// works now
#include "Box.h" // Box.h #includes <d3dx9.htoo
#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?

Sep 17 '07 #3

<dr*************@hotmail.comwrote in message
news:11**********************@y42g2000hsy.googlegr oups.com...
Okay, I got it to work (it compiles and links) if I comment out
#include <d3dx9.hat the top of the .h file that houses the managed
class

//#include <d3dx9.h// works now
#include "Box.h" // Box.h #includes <d3dx9.htoo
#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?
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.
Sep 17 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: David Kantowitz | last post by:
I am trying to wrap a native-C++ DLL in managed C++, to use in a .NET project. The native code is compiled into a DLL, and I have created a .def file that exports the mangled names of the...
2
by: Jacob Cohen | last post by:
Under VC7.1, I am trying to wrap a native-C++ DLL that contains C++ objects in a Managed-C++ class library for use in a C# project. I created and compiled the native DLL under VC7.1 as a Win32...
5
by: Julie | last post by:
I'm currently working in a mixed mode project where the exe is C#, there is a managed C++ (DLL) assembly, that in part, includes some calls into a native (unmamanged) DLL. I can build/link/run...
2
by: Martin Zenkel | last post by:
Dear VS Team, using the Beta 2 of VS 2005 I've encontered the following problem. Let's assume threre are three Dll's, one unmanaged and two managed. In the unmanaged we put a simple unmanged...
3
by: Adam | last post by:
I can't seem to find one spot on the net that specifies exactly what I need to do. Situation: Native dll needs to hold a static reference to a managed class in .net 2.0 (whidbey) which needs to...
9
by: Herby | last post by:
Is possible to have a managed method within a Native(un-managed) class within a \clr project? E.g. class myClass { public: #pragma managed void myMethod(void);
3
by: Lonewolf | last post by:
Hi all, I'm having difficulties passing data back to managed class from my native class when the data is generated from within a native thread in the native class itself. I will give the following...
14
by: Ben Voigt | last post by:
Under certain circumstances I get: First-chance exception at 0x7c812a5b (kernel32.dll) in LTMGUI.exe: 0xC0020001: The string binding is invalid. First-chance exception at 0x7c812a5b (kernel32.dll)...
5
by: =?Utf-8?B?U2hhcm9u?= | last post by:
I have a class that is writen in unmanaged pure native C++. This class files (h and cpp) are inserted to a managed C++ (VC++ 2005, C++/CLI) DLL compoenet. This DLL compoenet is used in a C#...
2
by: Bob Altman | last post by:
Hi all, We have a native class modeled after the System::Exception class, and all exceptions that we throw derive from this class. For now this class is quite simple: just Description and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.