kastnermario / yaml-cpp

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

Can not build Windows DLL (shared lib) with MSVC as corresponding import library is not created due to missing DLL exports #88

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Go to trunk
2. mkdir bin\vc2008
3. cd bin\vc2008
4. del /s /q * & rmdir /s /q .
5. cmake -DBUILD_SHARED_LIBS=ON -G "Visual Studio 9 2008" ..\..
   Note that I use the patched CMakeLists.tx from issue #87
6. Build any configuration with VS 2008

What version of the product are you using? On what operating system?
MS Visual Studio 2008 on Win XP SP3

Please provide any additional information below.

Projects "test" and "utils" can not be linked as the import library 
(yaml-cpp.lib) for the DLL is missing.
Reason is that nothing is marked for DLL export inside the DLL source code, so 
MSVC doesn't create it.

Creating the import library can be done in two ways, see 
http://msdn.microsoft.com/en-us/library/900axts6%28v=VS.90%29.aspx
a) either via exporting with __declspec(dllexport)
This is normally defined as a macro (see attached file "yaml_dll.h" to handle 
DLL and static libs building).

b) using a manually created .def file
http://msdn.microsoft.com/en-us/library/28d6s79h%28v=VS.90%29.aspx

Unfortunately I do not have any experience in C++ Windows DLL coding, so I do 
not know how to transform the yaml-cpp source code for correct DLL building.

Original issue reported on code.google.com by matthias...@gmail.com on 5 Jan 2011 at 10:33

Attachments:

GoogleCodeExporter commented 8 years ago
Attached patch for yaml_dll.h and updated CMakeLists.txt

Original comment by matthias...@gmail.com on 5 Jan 2011 at 11:08

GoogleCodeExporter commented 8 years ago
Updated patch to include format fixes.

Original comment by matthias...@gmail.com on 7 Jan 2011 at 10:38

GoogleCodeExporter commented 8 years ago
Deleted patch as all format fixes were committed in 432, and the header from 
the initial report is good enough to give an idea how to maybe solve this.

Original comment by matthias...@gmail.com on 2 Mar 2011 at 7:34

GoogleCodeExporter commented 8 years ago
Implemented, I believe, r473. It gives lots of C4251 warnings, which is for a 
member of an exported class not being exported itself. It seems that this is OK 
as long as you can't access that member. Other than that warning, it compiles 
properly and the tests execute correctly with the DLL. (I've been testing with 
VS2008.)

Original comment by jbe...@gmail.com on 16 Mar 2011 at 2:37