Ogre with clr:pure - it is possible?

maxwave

12-01-2007 22:45:48

Hello All!

I try to use Ogre with Windows Forms UserControls. But use of a UserControl requires compilation of the project in a mode clr:pure.

Whether probably to combine Ogre and this mode?

Game_Ender

12-01-2007 23:56:51

What is UserControls? Mogre is used by OgreStudio successfully with Windows.Forms I believe.

pjcast

13-01-2007 00:58:25

Yeah, Ogre Studio uses Windows.System.Forms.UserControl as the base for most all of its controls (including the OgreViews).

I'm not sure what mode CLR:pure is, but out of the box, Ogre + Mogre + .Net works fine ;)

Bekas

13-01-2007 04:03:14

But use of a UserControl requires compilation of the project in a mode clr:pure.
Well to be more exact UserControls compile fine with /clr, it's the designer that for some buggy reason can't handle them.

Whether probably to combine Ogre and this mode?
Nope, /clr:pure means no native code.
You should probably build your UserControls in a separate /clr:pure project and reference Ogre through a managed interface.

Or use Mogre and save yourself the trouble :wink:

maxwave

14-01-2007 23:19:37

Thanks by All! :) I will try to use MOgre. But I have one question:
I want use only C++ languege. Whether it will have an effect on productivity in comparison with original (clean) Ogre?

Bekas

15-01-2007 10:14:21

If you use only C++ then Mogre is a wrapping layer you don't really need, so I'd suggest sticking with C++/CLR.
Build the UserControls with /clr:pure and link them to another mixed-mode (/clr) library that makes the real calls to native Ogre.

maxwave

15-01-2007 15:07:45

I tried this. I have the separate project FreyOgreApp, in which I create and init Ogre with some public functions from class COgreApplication.
I compile it in mode clr as static libraly (.lib)

Then I create WinForms application and simply add libraly to input. When I try to link program, a have this.

Linking...
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "const std::bad_alloc::`vftable'" (??_7bad_alloc@std@@6B@) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "const std::bad_alloc::`RTTI Complete Object Locator'" (??_R4bad_alloc@std@@6B@) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "class std::bad_alloc `RTTI Type Descriptor'" (??_R0?AVbad_alloc@std@@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "std::bad_alloc::`RTTI Class Hierarchy Descriptor'" (??_R3bad_alloc@std@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "std::bad_alloc::`RTTI Base Class Array'" (??_R2bad_alloc@std@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "std::bad_alloc::`RTTI Base Class Descriptor at (0,-1,0,64)'" (??_R1A@?0A@EA@bad_alloc@std@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "std::exception::`RTTI Base Class Descriptor at (0,-1,0,64)'" (??_R1A@?0A@EA@exception@std@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "class std::exception `RTTI Type Descriptor'" (??_R0?AVexception@std@@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "std::exception::`RTTI Class Hierarchy Descriptor'" (??_R3exception@std@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "std::exception::`RTTI Base Class Array'" (??_R2exception@std@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "const std::logic_error::`vftable'" (??_7logic_error@std@@6B@) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "const std::logic_error::`RTTI Complete Object Locator'" (??_R4logic_error@std@@6B@) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "class std::logic_error `RTTI Type Descriptor'" (??_R0?AVlogic_error@std@@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "std::logic_error::`RTTI Class Hierarchy Descriptor'" (??_R3logic_error@std@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "std::logic_error::`RTTI Base Class Array'" (??_R2logic_error@std@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "std::logic_error::`RTTI Base Class Descriptor at (0,-1,0,64)'" (??_R1A@?0A@EA@logic_error@std@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "const std::length_error::`vftable'" (??_7length_error@std@@6B@) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "const std::length_error::`RTTI Complete Object Locator'" (??_R4length_error@std@@6B@) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "class std::length_error `RTTI Type Descriptor'" (??_R0?AVlength_error@std@@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "std::length_error::`RTTI Class Hierarchy Descriptor'" (??_R3length_error@std@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "std::length_error::`RTTI Base Class Array'" (??_R2length_error@std@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "std::length_error::`RTTI Base Class Descriptor at (0,-1,0,64)'" (??_R1A@?0A@EA@length_error@std@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "const std::runtime_error::`vftable'" (??_7runtime_error@std@@6B@) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "const std::runtime_error::`RTTI Complete Object Locator'" (??_R4runtime_error@std@@6B@) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "class std::runtime_error `RTTI Type Descriptor'" (??_R0?AVruntime_error@std@@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "std::runtime_error::`RTTI Class Hierarchy Descriptor'" (??_R3runtime_error@std@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "std::runtime_error::`RTTI Base Class Array'" (??_R2runtime_error@std@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "std::runtime_error::`RTTI Base Class Descriptor at (0,-1,0,64)'" (??_R1A@?0A@EA@runtime_error@std@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "const std::ios_base::failure::`vftable'" (??_7failure@ios_base@std@@6B@) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "const std::ios_base::failure::`RTTI Complete Object Locator'" (??_R4failure@ios_base@std@@6B@) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "class std::ios_base::failure `RTTI Type Descriptor'" (??_R0?AVfailure@ios_base@std@@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "std::ios_base::failure::`RTTI Class Hierarchy Descriptor'" (??_R3failure@ios_base@std@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "std::ios_base::failure::`RTTI Base Class Array'" (??_R2failure@ios_base@std@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "std::ios_base::failure::`RTTI Base Class Descriptor at (0,-1,0,64)'" (??_R1A@?0A@EA@failure@ios_base@std@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "const std::out_of_range::`vftable'" (??_7out_of_range@std@@6B@) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "const std::out_of_range::`RTTI Complete Object Locator'" (??_R4out_of_range@std@@6B@) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "class std::out_of_range `RTTI Type Descriptor'" (??_R0?AVout_of_range@std@@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "std::out_of_range::`RTTI Class Hierarchy Descriptor'" (??_R3out_of_range@std@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "std::out_of_range::`RTTI Base Class Array'" (??_R2out_of_range@std@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : error LNK2005: "std::out_of_range::`RTTI Base Class Descriptor at (0,-1,0,64)'" (??_R1A@?0A@EA@out_of_range@std@@8) already defined in lala.obj
FreyOgreApp_d.lib(Precompiled.obj) : fatal error LNK1313: ijw/native module detected; cannot link with pure modules

If I add FORCE:MULTIPLE option to Linker Command Line, the above errors comes warnings, but last error does not disappear.

How to link OgreApp (clr) and WinFormsApp(clr:pure)?

Bekas

15-01-2007 15:28:09

I compile it in mode clr as static libraly (.lib)
Actually I was suggesting that your user controls interface with Ogre through a dynamic link library.

maxwave

15-01-2007 16:58:02

Sorry for a noob question, but how to add reference to FreyOgreDll? I assume, that there are in Input Linker Settings?
Also I create FreyOgreApp.li to link my DLL with project. But how? (VS2005)

Bekas

15-01-2007 18:29:55

how to add reference to FreyOgreDll?
There are 2 ways:

-either go to Project Properties -> Common Properties -> References and press the "Add New Reference" button

-or, in your code, before using all the managed classes etc. from FreyOgreDll, add this:
#using "FreyOgreDll.dll"

Both ways will allow you to use a managed DLL (the managed classes from a /clr library) by a C++/CLR project

maxwave

15-01-2007 20:02:22

2Bekas
I tried 1st method, but it don't work, beacause the Character Set option was "Use Multi-Byte Character Set". I fix it to "Use Unicode Character Set" and I could add reference successful.

Thank you for help! :))