kastnermario / yaml-cpp

Automatically exported from code.google.com/p/yaml-cpp
MIT License
0 stars 0 forks source link

Won't compile on Windows due to several missing DLL exports #216

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Generate Visual Studio 2010 x64 build files using CMake
2. Compile from within Visual Studio 2010

What is the expected output? What do you see instead?
Expected output is a successful build, instead get multiple "undefined external 
symbol" linker errors.

What version of the product are you using? On what operating system?
v. 0.5.1 on Windows 8 x64 with Visual Studio 2010

Please provide any additional information below.
Attached diff (against release 0.5.1) fixes all but two of the errors. Due to 
time constraints, I can't look into this any further at the moment.

Original issue reported on code.google.com by WadeA...@gmail.com on 2 Aug 2013 at 12:24

Attachments:

GoogleCodeExporter commented 8 years ago
Forgot to mention that this only for the shared library build, not the static 
one.

Original comment by WadeA...@gmail.com on 2 Aug 2013 at 12:25

GoogleCodeExporter commented 8 years ago
Thanks!

Original comment by jbe...@gmail.com on 2 Aug 2013 at 1:06

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Thanks for pointing me to this. I got it to work by adding YAML_CPP_API to all 
the new API stuff. However I also had to get rid of 
"detail::node_data::empty_scalar", since static members don't get exported 
properly and it was needed by two inline functions (see: 
http://stackoverflow.com/questions/2479784/exporting-static-data-in-a-dll ), so 
consider this more of a "quick fix" than a "proper solution".

Edit: Updated patch

Original comment by supsu...@gmail.com on 16 Aug 2013 at 2:25

Attachments:

GoogleCodeExporter commented 8 years ago
This issue is still present. Compile as a static lib as a work around.

Original comment by markstah...@gmail.com on 14 Nov 2013 at 2:52

GoogleCodeExporter commented 8 years ago
I fixed most of the issues, re0b6d8095fce2a149d81e7d6aa72314e2a7ccb1e, but 
there are still the following errors:

3>load_node_test.obj : error LNK2019: unresolved external symbol 
"__declspec(dllimport) private: static bool __cdecl 
YAML::detail::node_data::equals(class YAML::detail::node &,char const *,class 
boost::shared_ptr<class YAML::detail::memory_holder>)" 
(__imp_?equals@node_data@detail@YAML@@CA_NAAVnode@23@PBDV?$shared_ptr@Vmemory_ho
lder@detail@YAML@@@boost@@@Z) referenced in function "public: class 
YAML::detail::node & __thiscall YAML::detail::node_data::get<char const 
[4]>(char const (&)[4],class boost::shared_ptr<class 
YAML::detail::memory_holder>)" 
(??$get@$$BY03$$CBD@node_data@detail@YAML@@QAEAAVnode@12@AAY03$$CBDV?$shared_ptr
@Vmemory_holder@detail@YAML@@@boost@@@Z)
3>node_spec_test.obj : error LNK2001: unresolved external symbol 
"__declspec(dllimport) private: static bool __cdecl 
YAML::detail::node_data::equals(class YAML::detail::node &,char const *,class 
boost::shared_ptr<class YAML::detail::memory_holder>)" 
(__imp_?equals@node_data@detail@YAML@@CA_NAAVnode@23@PBDV?$shared_ptr@Vmemory_ho
lder@detail@YAML@@@boost@@@Z)
3>node_test.obj : error LNK2001: unresolved external symbol 
"__declspec(dllimport) private: static bool __cdecl 
YAML::detail::node_data::equals(class YAML::detail::node &,char const *,class 
boost::shared_ptr<class YAML::detail::memory_holder>)" 
(__imp_?equals@node_data@detail@YAML@@CA_NAAVnode@23@PBDV?$shared_ptr@Vmemory_ho
lder@detail@YAML@@@boost@@@Z)

I don't understand why these symbols are missing, given that the method in 
question is inlined in a header file.

If anyone has a workaround, please let me know.

Original comment by jbe...@gmail.com on 24 Mar 2014 at 5:36

GoogleCodeExporter commented 8 years ago
Maybe since "public detail::node_data::get" is exported regardless of being 
inline (since it's part of an exported class), and it depends on "private 
detail::node_data::equals", then "private detail::node_data::equals" needs to 
be exported too regardless of being inline?

See this regarding exporting inline functions: 
http://blogs.msdn.com/b/oldnewthing/archive/2014/01/09/10488192.aspx

Original comment by supsu...@gmail.com on 3 Apr 2014 at 4:56

GoogleCodeExporter commented 8 years ago
I have the same problems. What is the status on the issue?

Original comment by mikhail....@gmail.com on 16 Nov 2014 at 11:06

GoogleCodeExporter commented 8 years ago

Original comment by jbe...@gmail.com on 29 Mar 2015 at 7:45

GoogleCodeExporter commented 8 years ago
Fixed, r0c6888b72c45.

Original comment by jbe...@gmail.com on 30 Mar 2015 at 2:18