Page 1 of 1

How to get libssl.lib and libcrypto.lib for MSC?

PostPosted: Wed Jul 26, 2023 4:15 pm
by Enrico Maria Giordano
Dear friends, what is the syntax to get libssl.lib and libcrypto.lib for MSC?

Re: How to get libssl.lib and libcrypto.lib for MSC?

PostPosted: Wed Jul 26, 2023 9:27 pm
by carlos vargas
Image
Image
vc_dll2lib.bat
@echo off
REM Usage: dll2lib [32|64] some-file.dll
REM
REM Generates some-file.lib from some-file.dll, making an intermediate
REM some-file.def from the results of dumpbin /exports some-file.dll.
REM Currently must run without path on DLL.
REM (Fix by removing path when of lib_name for LIBRARY line below?)
REM
REM Requires 'dumpbin' and 'lib' in PATH - run from VS developer prompt.
REM
REM Script inspired by http://stackoverflow.com/questions/9946 ... from-a-dll
SETLOCAL
if "%1"=="32" (set machine=x86) else (set machine=x64)
set dll_file=%2
set dll_file_no_ext=%dll_file:~0,-4%
set exports_file=%dll_file_no_ext%-exports.txt
set def_file=%dll_file_no_ext%.def
set lib_file=%dll_file_no_ext%.lib
set lib_name=%dll_file_no_ext%

dumpbin /exports %dll_file% > %exports_file%

echo LIBRARY %lib_name% > %def_file%
echo EXPORTS >> %def_file%
for /f "skip=19 tokens=1,4" %%A in (%exports_file%) do if NOT "%%B" == "" (echo %%B @%%A >> %def_file%)

lib /def:%def_file% /out:%lib_file% /machine:%machine%

REM Clean up temporary intermediate files
del %exports_file% %def_file% %dll_file_no_ext%.exp

Re: How to get libssl.lib and libcrypto.lib for MSC?

PostPosted: Wed Jul 26, 2023 10:01 pm
by Enrico Maria Giordano
Thank you.

Re: How to get libssl.lib and libcrypto.lib for MSC?

PostPosted: Sat Jul 29, 2023 8:45 am
by Enrico Maria Giordano
I just realize that the two libs for MSC (libssl.lib and libcrypto.lib) are already in the openssl distribution package (in the lib folder) so we don't need to build them ourself.