Hello!
This is driving me crazy, I've compiled (v2.0.6) AllegroFont both static and DLL but I cant use either one without problems 
Using the DLL version of the .lib I can compile my little test, run it untill I use:
alfont_destroy_font(Font);
MSVC pops up with
"Unhandled exception at 0xSOMEHEX in alfont_text.exe: User breakpoint."
What breakpoint???
Then I press continue and all is fine, but damn so annoying.
If I use the static .lib I cant even compile my test. Instead MSVC says
alfont_test error LNK2019: unresolved external symbol _ugetc referenced in function _alfont_ugetc
alfont_test error LNK2005: _clear_to_color already defined in alld.lib(alld42.dll)
alfont_test warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
alfont_test error LNK2019: unresolved external symbol _ugetxc referenced in function _alfont_text_length
Any ideas?
-EDIT-
Here's my minimal test
| 1 | #include <allegro.h> |
| 2 | #include "alfont.h" |
| 3 | |
| 4 | int main(void) |
| 5 | { |
| 6 | BITMAP *buffer; |
| 7 | ALFONT_FONT *Font; |
| 8 | if (allegro_init() != 0) return false; |
| 9 | install_keyboard(); |
| 10 | set_color_depth(32); |
| 11 | if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 400, 0, 0) != 0) { |
| 12 | allegro_message("Unable to set any graphic mode\n%s\n", allegro_error); |
| 13 | return false; |
| 14 | } |
| 15 | if (alfont_init() != ALFONT_OK) { |
| 16 | set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); |
| 17 | allegro_message("Error while initializing alfont"); |
| 18 | return false; |
| 19 | } |
| 20 | buffer = create_bitmap(SCREEN_W,SCREEN_H); |
| 21 | set_palette(desktop_palette); |
| 22 | |
| 23 | Font = alfont_load_font("fonts/phorfeir.ttf"); |
| 24 | alfont_set_font_size(Font,30); |
| 25 | |
| 26 | alfont_textout(screen, Font, "asdf", 30, 30, makecol(255,255,255)); |
| 27 | while(!key[KEY_ESC]) rest(1); |
| 28 | alfont_destroy_font(Font); |
| 29 | alfont_exit(); |
| 30 | destroy_bitmap(buffer); |
| 31 | return 0; |
| 32 | |
| 33 | } |
| 34 | END_OF_MAIN() |
Have you tried it with a standard compiler instead of MSVC?
The problem is with the runtime library you are linking with. When linking a static library link against Multi-threaded (/MT). When making a DLL link against Multi-threaded DLL (/MD). When you compile your program make sure that all the libraries and the program itself use the same runtime library. Don't ask further questions, that's all I know.
Have you tried it with a standard compiler instead of MSVC?
Never thought of that because it does come with project files for MSVC, although for v6 and I'm using v7.1.
I got the feeling I cant make a MSVC compitable .lib with say, MINGW.
The problem is with the runtime library you are linking with. When linking a static library link against Multi-threaded (/MT). When making a DLL link against Multi-threaded DLL (/MD). When you compile your program make sure that all the libraries and the program itself use the same runtime library. Don't ask further questions, that's all I know.
I've tried all the combinations I can, those that actually compile are the ones that give me the problems I described in the first post.
I guess, I'll have to live with FontEd and make some fuggly fonts without AA