You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by halplus shadowbit <ha...@gmail.com> on 2007/01/27 22:32:32 UTC

apr MSVC 2003 linking problems

Hello:

I'm getting this with Visual Studio 2003 with different versions of apr
0.9.x, 1.0.0 and the latest stable release. I am using c not c++

jpr.obj : error LNK2019: unresolved external symbol
__imp__apr_pool_create_ex@16 referenced in function _jpr_initialize@0
jpr.obj : error LNK2019: unresolved external symbol
__imp__apr_app_initialize@12 referenced in function _jpr_initialize@0
jpr.obj : error LNK2019: unresolved external symbol __imp__apr_terminate
referenced in function _jpr_terminate@0
jpr.obj : error LNK2019: unresolved external symbol
__imp__apr_pool_destroy@4 referenced in function _jpr_terminate@0
jpr_excep.obj : error LNK2019: unresolved external symbol
__imp__apr_threadkey_private_create@12 referenced in function
_jpr_excep_initialize
jpr_excep.obj : error LNK2019: unresolved external symbol
__imp__apr_threadkey_private_delete@4 referenced in function
_jpr_excep_terminate
jpr_excep.obj : error LNK2019: unresolved external symbol
__imp__apr_threadkey_private_set@8 referenced in function
__jpr_threadPushCtx@8
jpr_excep.obj : error LNK2019: unresolved external symbol
__imp__apr_threadkey_private_get@8 referenced in function
__jpr_threadPushCtx@8


It sould be linking for example with _apr_pool_create_ex@16 instead of
__imp__apr_pool_create_ex@16 at least that is the name the library is
exporting

Do I need to change something in the headers or... maybe define a symbol or
something else?





/* -------------------- This is the fragment of code that calls the macro
apr_pool_create  --------------------------- */

#include <apr_general.h>
#include <apr_pools.h>

#include "jpr_core.h"
#include "jpr_priv.h"

apr_pool_t *_jpr_global_pool = NULL;
static unsigned int _jpr_initialized = 0;
#ifdef WIN32
static int _targc = 0;
static char **_targv = NULL;
#endif

JPR_DECLARE(Jpr_status) jpr_initialize(void)
{
    apr_status_t rv;

    if (_jpr_initialized++) {
        return APR_SUCCESS;
    }

#ifdef WIN32
    if (_targc != __argc)
        _targc = __argc;

    if (_targv != __argv)
        _targv = __argv;

    rv = apr_app_initialize(&_targc, &_targv, NULL);
#else
    rv = apr_initialize();
#endif
    if (APR_SUCCESS == rv) {
        rv = apr_pool_create(&_jpr_global_pool, NULL);
    }

    if (APR_SUCCESS == rv) {
        rv = jpr_excep_initialize();
    }

    if (APR_SUCCESS != rv) {
        _jpr_initialized = 0;
    }

    return rv;
}

/* ------------------------------------------------------------------ */



Thanks in advance for your help
David