Hi

I experience problems linking using "external" keyword on Mac OS X. Program with declaration like

procedure glVertex3f(x, y, z: Single); cdecl; external 'GL' name 'glVertex3f';

fails to compile with

$ fpc external_decl.pas
/usr/bin/ld: Undefined symbols:
_glVertex3f
Error: Error while linking

(note the strange underscore at the beginning of reported "_glVertex3f").

Similar problems seem to arise with gtkglext unit under Mac OS X. What's interesting is that the problems are gone if I add {$linklib GL} (in case of glVertex3f example). So it seems to me that under Mac OS X
1. the name of the library specified after "external" keyword is ignored
2. I have to link to libraries using {$linklib xxx} method

This is what gtk2 unit uses, and it links OK with GTK library from fink. Also construct like function sem_post(__sem:Pointer): LongInt; cdecl; external 'c' name 'sem_post'; works OK in FPC's RTL, I guess that somewhere in Darwin RTL there's included {$linklib c}.

Am I right ? Is this a known limitation of FPC for Mac OS X, or should I submit to bugtracker ?

I'm attaching the small testcase.

Michalis

Attachment: external_decl.pas
Description: Binary data

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to