apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Graf László <gr...@datatrans.hu>
Subject DSO problem
Date Wed, 03 Mar 2010 20:27:33 GMT
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
                      -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_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));*/

       return 0;
       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);
       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,

View raw message