HELP (Dynamic loading)

From: Erick Gallesio <>
Date: Tue, 02 Aug 1994 17:12:47 +0100

Sorry for the previous incomplete post....
Complete message is here.

I use the dlopen/dlsym/dlclose functions for dynamic loading on SunOS 4.1.3
These functions also exist in Solaris 2.3 and OSF 1. However I am not able to
use them. Hereafter is a simple example which work on SunOS 4.1.3

    /* File main.c */

    #include <stdio.h>
    #include <dlfcn.h>

    int main()
      void *handle;
      void (*f)();

      printf("hello, ");
      if ((handle=dlopen("", 1)) == NULL) {
        fprintf(stderr, "Cannot open\n");
        return 1;
      f=dlsym(handle, "world");

    /* File world.c */

    #include <stdio.h>

    void world(void)

To compile the main program I do:
        gcc -o main main.c (i.e. nothing special)

I compile the world.c program with the -fpic option and load it with -assert
option to build
        gcc -fpic -c world.c
        ld -assert pure-text -o world.o

Is there someone on the mailing list which know how to make this program work
on Solaris 2 and Dec Alpha (which use dlxxxx) or on another system is running


                -- Erick
Received on Tue Aug 02 1994 - 17:12:48 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST