[redland-dev] Win32 issue: DLL builds and internal functions
Daniel Richard G.
oss at teragram.com
Wed Sep 5 17:28:43 EDT 2012
Hello list,
Raptor recently gained CMake build support, facilitating Windows builds.
However, it is not yet possible to build Raptor and its associated test
programs in DLL mode:
--------8<--------
cmd> cmake -G"NMake Makefiles" -DBUILD_SHARED_LIBS=ON \path\to\raptorSource
[CMake configuration output elided]
cmd> nmake
[...]
[ 74%] Building C object src/CMakeFiles/raptor2.dir/parsedate.c.obj
parsedate.c
Linking C shared library raptor2.dll
Creating library raptor2.lib and object raptor2.exp
Creating library raptor2.lib and object raptor2.exp
[ 74%] Built target raptor2
Scanning dependencies of target raptor_avltree_test
[ 75%] Building C object src/CMakeFiles/raptor_avltree_test.dir/raptor_avltree.c.obj
raptor_avltree.c
Linking C executable raptor_avltree_test.exe
raptor_avltree.c.obj : error LNK2019: unresolved external symbol raptor_basename referenced in function main
raptor_avltree_test.exe : fatal error LNK1120: 1 unresolved externals
LINK Pass 1 failed. with 2
NMAKE : fatal error U1077: 'cmake.exe' : return code '0xffffffff'
Stop.
NMAKE : fatal error U1077: 'nmake.exe' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'nmake.exe' : return code '0x2'
Stop.
-------->8--------
The problem is that numerous Raptor-internal functions are required by the
test programs, but these functions are unavailable because they were not
declared with the necessary DLL export/import linkage. Adding RAPTOR_API
to their declarations in raptor_internal.h and turtle_common.h allows the
build to complete.
(RAPTOR_API may be intended specifically to annotate Raptor's public-API
functions, however, so possibly another macro is desired here.)
The internal functions leading to "unresolved external symbol" linker
errors are the following:
raptor_basename
raptor_check_world_internal
raptor_free_id_set
raptor_free_turtle_writer
raptor_free_uri_detail
raptor_id_set_add
raptor_log_error_formatted
raptor_new_id_set
raptor_new_turtle_writer
raptor_new_uri_detail
raptor_parser_get_accept_header_all
raptor_parser_log_error_varargs
raptor_stringbuffer_append_turtle_string
raptor_turtle_writer_decrease_indent
raptor_turtle_writer_increase_indent
raptor_turtle_writer_literal
raptor_turtle_writer_namespace_prefix
raptor_turtle_writer_newline
raptor_turtle_writer_qname
raptor_turtle_writer_quoted_counted_string
raptor_turtle_writer_raw
raptor_turtle_writer_raw_counted
raptor_turtle_writer_reference
raptor_turtle_writer_set_option
turtle_qname_to_uri
turtle_syntax_error
The attached patch adds RAPTOR_API (for now) to the declarations of all of
the above, allowing a DLL build to complete successfully.
Questions and comments are welcome.
--Daniel
--
Daniel Richard G. || danielg at teragram.com || Software Developer
Teragram Linguistic Technologies (a division of SAS)
http://www.teragram.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: raptor-dll-linkage.patch
Type: text/x-diff
Size: 9035 bytes
Desc: Patch against git master
URL: <http://lists.librdf.org/pipermail/redland-dev/attachments/20120905/0987c6d3/attachment.patch>
More information about the redland-dev
mailing list