On Tue, Jun 19, 2018 at 9:17 AM, Oleg Sivokon <ol...@traiana.com> wrote:

> Hello list!
>
> Later, in Release directory I discovered libapr-1.lib which, as far as I
> understand is analogous to an *.a file (archive), and is used by MSVC to
> look up symbol definitions.
>

Note, it looks them up, but the code exists in libapr-1.dll. Think of the
pair as the equivalent of an .so file.

You'll also find an apr-1.lib, this is more the equivalent of an .a file,
and when linked to an executable the functions will be copied to the binary
(.exe).

I think you would want libapr-1.lib/libapr-1.so if you plan to load the
library at runtime from python, in the future.


> I then dropped this file in the directory I configured the linker to look
> into.  Here's the complete command line given to the linker:
>
> C:\Program Files (x86)\Microsoft Visual Studio
> 14.0\VC\BIN\x86_amd64\link.exe
>     /nologo
>     /INCREMENTAL:NO
>     /LTCG
>     /DLL
>     /MANIFEST:EMBED,ID=2
>     /MANIFESTUAC:NO
>     /LIBPATH:c:\dev\protopy\lib/apr
>     /LIBPATH:c:\bin\python\Libs
>     /LIBPATH:c:\dev\protopy\.venv\libs
>     /LIBPATH:c:\dev\protopy\.venv\PCbuild\amd64
>     "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio
> 14.0\VC\LIB\amd64"
>     "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\
> x64"
>     "/LIBPATH:C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64"
>     apr-1.lib
>     /EXPORT:PyInit_wrapped build\temp.win-amd64-3.6\Release\protopy/lib/
> descriptors.obj
>     build\temp.win-amd64-3.6\Release\protopy/lib/binparser.obj
>     build\temp.win-amd64-3.6\Release\protopy/lib/defparser.obj
>     build\temp.win-amd64-3.6\Release\protopy/lib/protopy.lex.obj
>     build\temp.win-amd64-3.6\Release\protopy/lib/protopy.tab.obj
>     build\temp.win-amd64-3.6\Release\protopy/lib/pyhelpers.obj
>     build\temp.win-amd64-3.6\Release\protopy/lib/list.obj
>     build\temp.win-amd64-3.6\Release\protopy/wrapper.obj
>     /OUT:build\lib.win-amd64-3.6\protopy\wrapped.cp36-win_amd64.pyd
>     /IMPLIB:build\temp.win-amd64-3.6\Release\protopy/lib\
> wrapped.cp36-win_amd64.lib
>
> formatted for readability.
>
> The error I'm getting:
>
> error LNK2001: unresolved external symbol \
>     __imp_apr_hash_set
>
> After running dumpbin.exe on libapr-1.lib, I can see that the symbols it
> exports are all named __imp__apr_something, while when liking with my code
> it looks for __imp_apr_something (notice single vs double underscores).
>

 You don't quote your cc flags, but I'm presuming that your code is
prepared to link to libapr-1.lib (dynamic library __imp[ort]__) but you are
linking above to apr-1.lib (not dynamic.)

If you want your code to link to apr-1.lib instead, and not have a dynamic
dependency to libapr-1.so, then be sure to add /D APR_STATIC when compiling
your code for Windows.

Reply via email to