Recent

Author Topic: Possible work-around for the calloc vs glibc issue  (Read 338 times)

Thaddy

  • Hero Member
  • *****
  • Posts: 13213
Possible work-around for the calloc vs glibc issue
« on: June 09, 2023, 10:13:31 am »
Last month Florian asked if there was a work-around for the missing calloc if you dynamically linked your program with a recent version. The linker seems alwas to expect your executables to be linked against glibc otherwise you get a missing calloc error.

A possible work-around is maybe to add a calloc function to system ?
Code: Pascal  [Select][+][-]
  1. function calloc(nitems,nsize:size_t):pointer;inline;cdecl;
  2. begin
  3.   calloc := allocmem(nitems*nsize);
  4. end;

It may fool the linker into seeing that one first. I checked it is fully compatible with the glibc function and the pointer can subsequently also be used with other c functions even if you link against glibc.
« Last Edit: June 09, 2023, 01:26:52 pm by Thaddy »
I actually get compliments for being rude... (well, Dutch, but that is the same)

 

TinyPortal © 2005-2018