libbcrypt icon indicating copy to clipboard operation
libbcrypt copied to clipboard

Windows MSVC with shared libraries

Open xxxcucus opened this issue 4 years ago • 6 comments

In Windows with Visual Studio 2019, BUILD_SHARED_LIBS option active, I receive an error when compiling because bcrypt.lib is not created. This impedes using the library in larger projects where the library should be built as shared library.

xxxcucus avatar Mar 06 '21 12:03 xxxcucus

Given the fact that this is a library consisting of one .hpp and four .c files, could you provide a PR for the build process to do this?

trusch avatar Mar 06 '21 15:03 trusch

I just merged a PR with support for visual studio 2019. Could you try again?

trusch avatar Mar 06 '21 15:03 trusch

Now it generates bcrypt.lib but when I look in the project properties I see that the library is generated as static library. Moreover I would like to generate the project myself only from the CMakeLists.txt file. At them moment when generating project from CMakeLists.txt it does not create bcrypt.lib (with BUILD_SHARED_LIBS flag)

I have tried to generate the .lib file myself but have still not found a solution.

xxxcucus avatar Mar 06 '21 16:03 xxxcucus

What is the role of the .S file there ? I think that without it I can manage to generate .lib for shared library with MSVC.

xxxcucus avatar Mar 06 '21 16:03 xxxcucus

The file seems to be used only for i386 architecture. For my needs (x86_64) I can ignore it and try to do without it. I will let you know how that worked.

xxxcucus avatar Mar 07 '21 11:03 xxxcucus

I would suggest adding a cmake variable for compiling the i386 version. When the flag is not active one could active the export of all simbol for windows. This will allow compiling as shared library with Msvc. For the remaining case I do not know. Maybe some one has an idea.

xxxcucus avatar Mar 10 '21 19:03 xxxcucus