[SOLVED] Panda/Rocket initializing issues

Hey !

I have a very limited knowledge of the rendering with the libRocket, but when I ported my project to Windows I noticed that there was a lot of null pointer issues with the libRocket, apparently coming from stuff that should’ve been initialized with Rocket::Core::Initialise.

I looked into this matter for two hours now and I think I went as far as I can get. The result of my investigation is the weird few lines that you can see here:

int main(void)
{
  init_librocket();
  Core::Initialise();
  return (0);
}

I found the init_librocket by probing Panda’s code, and reading the description it seemed to be exactly what I needed.
I set breakpoints into Core::Initialise, and it turns out that it is never called before my own call to Core::Initialise. Which is weird you know, because that means that init_librocket didn’t call Core::Initialise. Which is impossible.

What can possibly be happening to me ?
Any clue or idea on how to debug this is more than welcome !

init_librocket is called at static init time, so when you call it in your main(), it has already been called and therefore doesn’t do anything.

So, you don’t need to call either function - well, the init_librocket line can’t really hurt, anyway, and in your case it makes sure that libp3rocket does get linked in. Perhaps your explicit call to Initialise() is causing the problem?

However, perhaps it could be that librocket isn’t really static init safe, and that the issues you’re seeing are in fact caused by libRocket static initialisers being called after init_librocket is called. I haven’t had this type of issue with libRocket before, but I can’t rule it out; I can’t offer a different explanation for your problem right now.

My bad, I just don’t understand how the solution didn’t pop to my head instantly… it’s so freaking obvious !

The reason why init_librocket doesn’t work is that it works just fine. It’s just that Core::Initialise in init_librocket doesn’t point to the same place as Core::Initialise in the ‘local’ code.

So this meant Panda3D wasn’t built with the same Rocket’s lib files as my project.
After complete rebuild of everything, it was indeed the case.
Problem solved.