[fpc-pascal] libc and math.h on Linux

Karoly Balogh (Charlie/SGR) charlie at scenergy.dfmk.hu
Fri Feb 2 12:56:52 CET 2018


On Fri, 2 Feb 2018, Adriaan van Os wrote:

> I have to import the math.h libc functions listed here
> <http://pubs.opengroup.org/onlinepubs/009695399/toc.htm>. What is the
> recommended way to do this for general Linux compatibility ? Simply
> declare them external ? Load them from libc dynamically ? Anything else
> ? I know that the FPC runtime lib itself jumps through some hoops to be
> as independent of libc (or a specific version of libc) as possible.

We actually link against libc and pthreads when multithreading is involved
on Unices. You need to declare all functions cdecl; external;

See the cmem unit in the RTL for example, which provides simple
link-against-C examples for a number of platforms, both dynamic and static
linking case (pick the option which fits best your usecase):



More information about the fpc-pascal mailing list