[fpc-devel] fnmatch (linux), where is the external code/symbol located?

robert rozee rozee at mail.com
Mon Oct 16 17:03:09 CEST 2023


when rebuilding FPC (version 3.2.2, Lazarus 2.2.6, "x86_64-linux-gtk2") from sources, the compiler processes the symbol "fnmatch" that is 'paired' with the library "libgtk-x11-2.0.so". i have traced this back to the source file /usr/share/fpcsrc/3.2.2/packages/gtk2/src/gtk+/gtk/fnmatch.pas and in particular the following function declaration therein:

    { Match STRING against the filename pattern PATTERN,
       returning zero if it matches, FNM_NOMATCH if not.   }
    function fnmatch(__pattern: char; __string: char;
      __flags: gint): gint; cdecl; external gtklib;

 located at around line 36. the constant gtklib is defined in the file /usr/share/fpcsrc/3.2.2/packages/gtk2/src/gtk+/gtk/gtk2.pas as:

const
      gtklib = 'libgtk-x11-2.0.so';

however, the library "libgtk-x11-2.0.so" does NOT contain a symbol/function "fnmatch".


is anyone able to tell me where the symbol "fnmatch" resolves to? i have spent a number of days working on this without success. note that editing fnmatch.pas to either of the following variations:

function fnmatch( ... ) ... external;
function fnmatch( ... ) ... external 'libc';

both yield a compiler that, while capable of compiling a working terminal application, can NOT compile a (gtk2) GUI application. so the symbol "fnmatch" is NOT resolving to a match in "libc.so.6" where one would normally expect to find fnmatch defined.

many thanks for any help that can be offered...


cheers,
rob   :-)


More information about the fpc-devel mailing list