Compiling the DeathMatch DLL

Get technical support about the C++ source code and about Lua scripts for maps, entities, GUIs, the console, materials, etc. Also covered are the Cafu libraries and APIs, as well as compiling, linking, and the build system.
Post Reply
User avatar
BRabbit
Posts: 28
Joined: 2010-08-16, 19:26
Location: Moscow, Russia

Compiling the DeathMatch DLL

Post by BRabbit » 2010-11-16, 01:03

Hi Carten, today I finished compiling the DeathMatch DLL, everything was ok, but when I try to open it within the Cafu main executable, I get an unhandled exception with the LoadLibrary() function. Replacing it to the scons-generated DLL works right.
The thing is that I'm almost using the same project configuration (the /J switch, multithreaded static debug linking of the C libraries, etc) of the OpenGl12 Renderer DLL, which I compiled using my visual studio solution and it works fine.
What could be causing this error?

Also, when using CaWE (vc++ solution-generated too) everything works right too- but the option Tie to entity is not working. I mean, I just create a block brush, I select it, but when I try to tie it to an entity I get the message 'Nothing is selected that could be tied to an entity'. Here's the code:

Code: Select all

void MapDocumentT::OnToolsAssignPrimToEntity(wxCommandEvent& CE)
{
    ToolT* NewEntityTool = m_ChildFrame->GetToolManager().GetTool(*GetToolTIM().FindTypeInfoByName("ToolNewEntityT"));
if (!NewEntityTool) return;
    OptionsBar_NewEntityToolT* Bar=dynamic_cast<OptionsBar_NewEntityToolT*>(NewEntityTool->GetOptionsBar());
if (!Bar) return;

    ArrayT<MapEntityT*>    SelEntities;     // All entities   that are in the selection.
    ArrayT<MapPrimitiveT*> SelPrimitives;   // All primitives that are in the selection.

    for (unsigned long SelNr=0; SelNr<m_Selection.Size(); SelNr++)
    {
        MapElementT* Elem=m_Selection[SelNr];

        if (Elem->GetType()==&MapEntityT::TypeInfo)
        {
            SelEntities.PushBack(static_cast<MapEntityT*>(Elem));
        }
        else if (Elem->GetType()==&MapPrimitiveT::TypeInfo)
        {
            SelPrimitives.PushBack(static_cast<MapPrimitiveT*>(Elem));
        }
    }

    // If there were no primitives among the selected map elements, quit here.
    if (SelPrimitives.Size()==0)
    {
        wxMessageBox("Nothing is selected that could be tied to an entity.");
        return;
    }

....it continues
The thing is that the part

Code: Select all

Elem->GetType()==&MapPrimitiveT::TypeInfo
should return true, but it doesn't. So it's something with the TypeInfo system.
I checked the TypeInfos of MapBrushT, MapPrimitiveT and MapElementT and everything is ok. MapBrushT inherits from the MapPrimitiveT class which in turn inherits from MapElementT.
So, I'm pretty sure that Elem is a MapBrushT (got it using the debugger), but its GetType() it's not equal to &MapPrimitiveT::TypeInfo?. :frown:
User avatar
Carsten
Site Admin
Posts: 2160
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Re: Compiling the DeathMatch DLL

Post by Carsten » 2010-11-16, 10:40

Hi BigJJ,
BRabbit wrote:today I finished compiling the DeathMatch DLL, everything was ok, but when I try to open it within the Cafu main executable, I get an unhandled exception with the LoadLibrary() function. Replacing it to the scons-generated DLL works right.
The thing is that I'm almost using the same project configuration (the /J switch, multithreaded static debug linking of the C libraries, etc) of the OpenGl12 Renderer DLL, which I compiled using my visual studio solution and it works fine.
What could be causing this error?
Well, that's hard to tell. The first obvious questions are:
  • Where does the exception come from (stack trace)?
  • Did you have a look at http://trac.cafu.de/browser/cafu/trunk/ ... SConscript ? It's pretty straightforward, but you should still check it as you normally cannot carry the details from unrelated OpenGL12 DLL to DeathMatch DLL.
Also, when using CaWE (vc++ solution-generated too) everything works right too- but the option Tie to entity is not working.
This has been fixed in http://trac.cafu.de/changeset/99, which you should apply to your local code as well.

Generally, I'd recommend keeping up-to-date with changes to Cafu source code, although I realize that this is (currently) not easily done.
Until we have a solution that works more generally,
  • one option is to apply patches to your local copy manually, as with the patch for changeset 99 above.
  • Another option is to checkout the Cafu repository besides your normal local development tree, and use a tool like Beyond Compare for syncing the two directory trees.
  • Yet another option (that we're currently exploring here as well) is to clone the Subversion repository as a Git or Mercurial repository locally. This is the most complex but also the most comfortable solution, as you would be able to develop your own project and be able to pull and integrate changes to the official Cafu code automatically.
    Also see How do I locally clone the Cafu source code repository? for more details.
Best regards,
Carsten
User avatar
BRabbit
Posts: 28
Joined: 2010-08-16, 19:26
Location: Moscow, Russia

Re: Compiling the DeathMatch DLL

Post by BRabbit » 2010-11-21, 20:15

-I managed to get to work the DeathMatch DLL :D by compiling with a different bullet collision library (I was mixing up the cafu Libs compiled with my visual studio solution and most of the ExtLibs generated with the SCons system. Microsoft recommends not to mix libraries compiled with different versions of the compiler, and the external libraries were built with Visual Studio 2008 Sp1 and the other libraries without the Service Pack). :mrgreen:
Last edited by BRabbit on 2010-11-22, 18:02, edited 1 time in total.
User avatar
Carsten
Site Admin
Posts: 2160
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Re: Compiling the DeathMatch DLL

Post by Carsten » 2010-11-22, 12:48

Hi BRabbit,
BRabbit wrote:-I managed to get to work the DeathMatch DLL :D by compiling with a different bullet collision library (I was mixing up the cafu Libs compiled with my visual studio solution and most of the ExtLibs generated with the SCons system.
Well, you cannot (in general) do such mixes...
Do I understand correctly that this works now for you?

For your other questions, I've split them into separate threads, please see for details.

For the future, please start new threads for new topics! This way it's easier to answer and keep track of each, to search them, etc. :up:
Best regards,
Carsten
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests