[fpc-pascal]Dynamic Symbol Information For Functions and Procedures in Linux ELF

Michael Van Canneyt michael.vancanneyt at wisa.be
Fri Jun 1 09:18:22 CEST 2001


On Fri, 1 Jun 2001, Ecmel ERCAN wrote:

> Hi,
>
> I am new to Linux and Free Pascal so please forgive me If I am asking
> a silly question :)
>
> I have converted libglade headers to free pascal but I need
> to know how to include the dynamic symbol information for
> gtk event handler functions in the final ELF file.
>
> For example; I compile the following C program:
>
> #include <gtk/gtk.h>
> #include <glade/glade.h>
>
> void on_window1_destroy(GtkWidget *widget, gpointer user_data) {
>   /* do something useful here */
>   gtk_main_quit();
> }
>
> int main(int argc, char *argv[]) {
>     GladeXML *xml;
>
>     gtk_init(&argc, &argv);
>     glade_gnome_init();
>
>     /* load the interface */
>     xml = glade_xml_new("test.glade", NULL);
>     /* connect the signals in the interface */
>     glade_xml_signal_autoconnect(xml);
>     /* start the event loop */
>     gtk_main();
>     return 0;
> }
>
>
>
> Now if I use objdump -T on the generated ELF file, I can see the
> on_window1_destroy function is in the list.
>
> But when I compile the pascal version it does not get into the
> dynamic symbol info table:

The problem is that 'on_window1_destroy' is mangled to ON_WINDOW1_DESTROY$$XX$YY etc.
This is necessary because
1) Pascal is case sensitive
2) We support overloading of funtions.
So names are mangled. One way to solve this is to put an alias modifier behind it:

procedure on_window1_destroy (widget : PGtkWidget; data: Pgpointer); cdecl; [alias: 'on_window1_destroy'];

This will create an extra symbol with the correct casing.

Michael.






More information about the fpc-pascal mailing list