Skip to main content
GameDev.net gamedev.net
🔒 Locked

Can't get FTGL to work

Started by Tera_Dragon Apr 20, 2006 at 9:45 AM 3 replies 1.9k views
Original Post
Tera_Dragon
Tera_Dragon
I've built the libs and dll, but to be able to build the dynamic lib and dll I had to change the freetype included lib from freetype204MT_D.lib to freetype.lib as that was the only freetype lib I had. It seemed to work though. I included the libs and added the dll to my project directory, but when I run it I get the following error: File: i386/chkesp.c Line: 42 The value of ESP was not properly saved across a function call. This is usually the result of calling a function declared with one calling convention with a function pointer declared with a different calling convention I'm not sure where I should even start with this...
____________________________________________________________Programmers Resource Central
tstrimp
tstrimp
I had a hell of a time trying to get FTGL to work and eventually just moved on to GLFT_Font which was written by our very own cozman. I know it doesn't help get FTGL going but it's another GL font solution.
Evil Steve
Evil Steve
Find what function it's referring to (use the call stack), and check its calling convention. Does FTGL use LoadLibrary() and GetProcAddress() at all? That's uaully where you'll see these problems - the function may be using __stdcall in the DLL, but the function prototype (how it's called) may be using __cdecl.

The other alternative is stack corruption...
Tera_Dragon
Tera_Dragon
The function it's referring to is either ftgl_dynamic_MTD_d.dll!FTLibrary::Instance() or MSVCRTD.DLL!__chkesp(). __chkesp is the last one on the stack, and it looks like the error occurs just after calling it (I'm not familiar with doing this).
I can't work out how to find the calling convention of the functions.
____________________________________________________________Programmers Resource Central
Evil Steve
Evil Steve
Ignore checkesp, that's added by the compiler to catch bugs like this. So the problem is in FTLibrary::Instance() in ftgl_dynamic_MTD_d.dll.
I'm not sure if there's a problem with calling conventions if that's a member function. Although it's begining to sound like FTGL is just borked :P

To check the calling conventions for normal functions, just find the declaration of the function. If it's something like int __stdcall foo(); then it's declared to use the stdcall calling convention. If it's not mentioned, then it's __cdecl.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.