Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
GoogleCodeExporter opened this issue Mar 30, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

Attached patch for yaml_dll.h and updated CMakeLists.txt

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

  • Added labels: ****
  • Removed labels: ****

Attachments:

@GoogleCodeExporter
Copy link
Author

Updated patch to include format fixes.

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

  • Added labels: ****
  • Removed labels: ****

Attachments:

@GoogleCodeExporter
Copy link
Author

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

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

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

  • Changed state: Fixed
  • Added labels: ****
  • Removed labels: ****

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant