Note that there are some explanatory texts on larger screens.

plurals
  1. POLinking Free Pascal programs to include dependencies
    primarykey
    data
    text
    <p>I have two Free Pascal units that I would like to use from a C program on linux.</p> <p>Here is what I do:</p> <pre><code>$ fpc -fPIC base64.pas queueutils.pas Warning: Only one source file supported Free Pascal Compiler version 2.2.2 [2008/11/05] for x86_64 Copyright (c) 1993-2008 by Florian Klaempfl Target OS: Linux for x86-64 Compiling queueutils.pas queueutils.pas(2088,11) Warning: Symbol "Socket" is deprecated queueutils.pas(2097,10) Warning: Symbol "Connect" is deprecated queueutils.pas(2104,3) Warning: Symbol "Sock2Text" is deprecated 2432 lines compiled, 0.5 sec 4 warning(s) issued $ ppumove -o queueutils -e ppl *.ppu PPU-Mover Version 2.1.1 Copyright (c) 1998-2007 by the Free Pascal Development Team Processing base64.ppu... Done. Processing queueutils.ppu... Done. Linking queueutils.o base64.o Done. </code></pre> <p>Seems fine so far, libqueueutils.so is created:</p> <pre><code>$ file libqueueutils.so libqueueutils.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped $ ldd libqueueutils.so ldd: warning: you do not have execution permission for `./libqueueutils.so' statically linked </code></pre> <p>However when the C program tries to use the library this way:</p> <pre><code>libqueue = dlopen("./libqueueutils.so", RTLD_LAZY); if (!libqueue) { fprintf (stderr, "%s\n", dlerror()); } </code></pre> <p>it yields an error message:</p> <pre><code>$ ./tmbrkr ./libqueueutils.so: undefined symbol: VMT_PROCESS_TPROCESS </code></pre> <p>This VMT_PROCESS_TPROCESS-related error is resolved if I add process.o and process.ppu to the linking process done by ppumove. However after doing so another unit is missing and after that another... You get it.</p> <p>Is there a way to somehow link all the necessary units together in one .so file so that the C program can dlopen() the library properly?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload