Hi all,

I test the DSO sample from http://dev.ariel-networks.com/ on Linux and it works fine. OK, now I would like to test my own little library.

Its header file, apr_dso_f.h contains this function:

   static int f10(int p1);

and its source file contains these lines:

   #include <apr_dso_f.h>
   static int f10(int p1)
   {
        return p1*10;
   }

It compiles fine with the following command:

c:\MinGW\bin\gcc.exe apr_dso_f.c
                     -I e:\src\c_cpp\apr_test
                     -shared
                     -o apr_dso_f.so

I added the folder containig the apr_dso_f.so file to the PATH variable so the following test program does not complain about anything:

   #include <stdio.h>
   #include <stdlib.h>
   #include <assert.h>
   #include <apr_general.h>
   #include <apr_dso.h>

   int main(int argc, const char *argv[])
   {
      apr_status_t rv;
      apr_pool_t *mp;
      const char fname[] = "apr_dso_f.so";
      apr_dso_handle_t *dso_h;

   /*typedef int (*f10_t)(int x);
   f10_t f10;*/

      apr_initialize();
      apr_pool_create(&mp, NULL);

      if ((rv = apr_dso_load(&dso_h, fname, mp)) != APR_SUCCESS) {
         goto error;
      }
/*if ((rv = apr_dso_sym((apr_dso_handle_sym_t*)&f10, dso_h, "f10")) != APR_SUCCESS) {
      goto error;
   }
   printf("%d\n", f10(12));*/

      apr_dso_unload(dso_h);
      apr_pool_destroy(mp);
      apr_terminate();
      return 0;
   error:
   {
      char errbuf[256];
      apr_strerror(rv, errbuf, sizeof(errbuf));
      printf("error: %d, %s (%s)\n", rv, errbuf, fname);
      apr_dso_error(dso_h, errbuf, sizeof(errbuf));
      printf("dso-error: %d, %s (%s)\n", rv, errbuf, fname);
   }
      apr_terminate();
      return -1;
   }

After removing the comment, building it and running it, fails with the following messages:

error: 720127, The specified procedure could not be found.   (apr_dso_f.so)
dso-error: 720127, No error (apr_dso_f.so)

Can somebody help me?

Thank you,
grafl


Reply via email to