Matthias Braun wrote:
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.
You mean a pointer to a pointer (because you already declared it as a pointer)?
Perhaps C uses some #defines in a header like: #define screen (*_impl__screen)
So you can replace screen by _impl__screen^ in the Pascal files, or you write access routines in C for which you provide a Pascal interface. The advantages are, the C routine use the headers and therefore all the macros the library uses (even if they change it in future versions or on different platforms), and you know the header of your C routines, therefore you can write a matching Pascal interface (also independent on any strangeness the library does).
Frank