Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML 2.0 - Static builds  (Read 8156 times)

0 Members and 1 Guest are viewing this topic.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
SFML 2.0 - Static builds
« Reply #15 on: June 20, 2011, 06:22:19 pm »
Are you sure that everything's being compiled as 32 bits (both SFML and your project)?
Laurent Gomila - SFML developer

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
SFML 2.0 - Static builds
« Reply #16 on: June 20, 2011, 06:52:16 pm »
Yeah I think so. I've configured CMake to use the default VC 2005 32-bit compiler, and my game is configured with MachineX86 (/MACHINE:X86)

So that's as 32-bit as it's going to get, I reckon.

I can't figure out why Debug build works, but Release doesn't. Both configurations have exactly the same settings except that in Debug, obviously, debug info is generated, and I do not static link.

So I just changed the Debug to static link, and guess what? It works.

So, it (by that logic) cannot be due to static linking.

 :cry:

Edit: I meant to ask before, but since the crash occurs in sf::Text SetString, in this code, why is myString = string, and not myString = &string ? When myFont = &font .....? I think I know the answer but I'm not sure....

Code: [Select]

////////////////////////////////////////////////////////////
void Text::SetString(const String& string)
{
    myString = string;
    myRectUpdated = false;
}


////////////////////////////////////////////////////////////
void Text::SetFont(const Font& font)
{
    if (myFont != &font)
    {
        myFont = &font;
        myRectUpdated = false;
    }
}


Thanks
SFML 2.1

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
SFML 2.0 - Static builds
« Reply #17 on: June 20, 2011, 07:08:54 pm »
Strings must be copied, nobody wants an object to point to an external string that must be maintained and kept alive separately ;)
Laurent Gomila - SFML developer

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
SFML 2.0 - Static builds
« Reply #18 on: June 21, 2011, 04:47:17 pm »
I was mixing static and dynamic. I missed unticking the BUILD_SHARED_LIBS option.

So now I have recompiled SFML and it all works - no crazy heap allocation errors!

Thread closed....
SFML 2.1