We're doing a project at school (a small game), because most pupils in my class only program in pascal, we have a project with mixed C / Pascal. As a gfx library we use allegro. This mix worked great under djgpp, but we wanted some tcp/ip networking, so I tried to port things to cygwin. (I'll publish the gpc allegro wrapper I wrote after the project)
linking with windows gives some strange problems with global vars: A long description follows:
A typical line from allunit.pas is: var screen: BITMAP_ptr; asmname 'screen'; external; this produces a screen not found when linking the thing, however, linking the C files suceed. So I looked at the symbols with objdump -t -T, and saw that the C object files use __imp_screen instead of _screen, although C Declaration is also BITMAP *screen;
So I tried to changed the code to screen : BITMAP_ptr; asmname '_impl__screen'; external; which linked ok, but produced crashing progs. After some investigation, I discovered, that these __imp_screen, aren't the global var itself but a pointer to the var. This is bad, because it would mean to change all pascal files. C compiler seems to do this automagically.
Am I doing something wrong or can't gpc handle dll stuff right?
Matze