[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apr-dev
Subject:    apr MSVC 2003 linking problems
From:       "halplus shadowbit" <halplus () gmail ! com>
Date:       2007-01-27 21:32:32
Message-ID: b64a985e0701271332g8ee96b3rc5911ce6cba87ab9 () mail ! gmail ! com
[Download RAW message or body]

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

[Attachment #3 (text/html)]

Hello:<br><br>I&#39;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++<br><br>jpr.obj : \
error LNK2019: unresolved external symbol __imp__apr_pool_create_ex@16 referenced in \
function _jpr_initialize@0 <br>jpr.obj : error LNK2019: unresolved external symbol \
__imp__apr_app_initialize@12 referenced in function _jpr_initialize@0<br>jpr.obj : \
error LNK2019: unresolved external symbol __imp__apr_terminate referenced in function \
_jpr_terminate@0 <br>jpr.obj : error LNK2019: unresolved external symbol \
__imp__apr_pool_destroy@4 referenced in function _jpr_terminate@0<br>jpr_excep.obj : \
error LNK2019: unresolved external symbol __imp__apr_threadkey_private_create@12 \
referenced in function _jpr_excep_initialize <br>jpr_excep.obj : error LNK2019: \
unresolved external symbol __imp__apr_threadkey_private_delete@4 referenced in \
function _jpr_excep_terminate<br>jpr_excep.obj : error LNK2019: unresolved external \
symbol __imp__apr_threadkey_private_set@8 referenced in function \
__jpr_threadPushCtx@8 <br>jpr_excep.obj : error LNK2019: unresolved external symbol \
__imp__apr_threadkey_private_get@8 referenced in function \
__jpr_threadPushCtx@8<br><br><br>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 <br><br>Do I need to change something in the headers \
or... maybe define a symbol or something else?<br><br><br><br><br><br>/* \
-------------------- This is the fragment of code that calls the macro \
apr_pool_create&nbsp; --------------------------- */ <br><br>#include \
&lt;apr_general.h&gt;<br>#include &lt;apr_pools.h&gt;<br><br>#include \
&quot;jpr_core.h&quot;<br>#include &quot;jpr_priv.h&quot;<br><br>apr_pool_t \
*_jpr_global_pool = NULL;<br>static unsigned int _jpr_initialized = 0; <br>#ifdef \
WIN32<br>static int _targc = 0;<br>static char **_targv = \
NULL;<br>#endif<br><br>JPR_DECLARE(Jpr_status) \
jpr_initialize(void)<br>{<br>&nbsp;&nbsp;&nbsp; apr_status_t \
rv;<br><br>&nbsp;&nbsp;&nbsp; if (_jpr_initialized++) \
{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return APR_SUCCESS; \
<br>&nbsp;&nbsp;&nbsp; }<br><br>#ifdef WIN32<br>&nbsp;&nbsp;&nbsp; if (_targc != \
__argc)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _targc = \
__argc;<br><br>&nbsp;&nbsp;&nbsp; if (_targv != \
__argv)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _targv = \
__argv;<br><br>&nbsp;&nbsp;&nbsp; rv = apr_app_initialize(&amp;_targc, &amp;_targv, \
NULL);<br>#else <br>&nbsp;&nbsp;&nbsp; rv = \
apr_initialize();<br>#endif<br>&nbsp;&nbsp;&nbsp; if (APR_SUCCESS == rv) \
{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rv = \
apr_pool_create(&amp;_jpr_global_pool, NULL);<br>&nbsp;&nbsp;&nbsp; \
}<br><br>&nbsp;&nbsp;&nbsp; if (APR_SUCCESS == rv) \
{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rv = jpr_excep_initialize();<br> \
&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; if (APR_SUCCESS != rv) \
{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _jpr_initialized = \
0;<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; return rv;<br>}<br><br>/* \
------------------------------------------------------------------ \
*/<br><br><br><br>Thanks in advance for your help <br>David



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic