Load OpenSSL dll successfully on Windows platforms.

This commit is contained in:
郑树新 2023-12-15 16:20:21 +08:00
parent 57b9b904b8
commit 1331b420b3
7 changed files with 58 additions and 18 deletions

View File

@ -341,7 +341,7 @@
<PreprocessorDefinitions>NDEBUG;_LIB;_MT;ACL_PREPARE_COMPILE;ACL_DLL;ACL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<ProgramDataBaseFileName>$(ProjectName).pdb</ProgramDataBaseFileName>
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<SDLCheck>false</SDLCheck>
</ClCompile>
@ -391,7 +391,7 @@
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<ProgramDataBaseFileName>$(ProjectName)_d.pdb</ProgramDataBaseFileName>
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<SDLCheck>false</SDLCheck>

View File

@ -203,7 +203,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\include;..\lib_acl\include;..\lib_protocol\include;..\include\sqlite;..\include\mysql;..\include\pgsql;..\include\openssl-1.1.1q;..\include;.\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_LIB;_MT;USE_WIN_ICONV;HAS_MYSQL_DLL;HAS_SQLITE_DLL;HAS_PGSQL_DLL;HAS_POLARSSL_DLL;HAS_MBEDTLS_DLL;HAS_ZLIB_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_LIB;_MT;USE_WIN_ICONV;HAS_MYSQL_DLL;HAS_SQLITE_DLL;HAS_PGSQL_DLL;HAS_POLARSSL_DLL;HAS_MBEDTLS_DLL;HAS_OPENSSL_DLL;HAS_ZLIB_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
@ -227,7 +227,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>.\include;..\lib_acl\include;..\lib_protocol\include;..\include\sqlite;..\include\mysql;..\include\pgsql;..\include\openssl-1.1.1q;..\include;.\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;_LIB;USE_WIN_ICONV;HAS_MYSQL_DLL;HAS_SQLITE_DLL;HAS_PGSQL_DLL;HAS_POLARSSL_DLL;HAS_MBEDTLS_DLL;HAS_ZLIB_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_LIB;USE_WIN_ICONV;HAS_MYSQL_DLL;HAS_SQLITE_DLL;HAS_PGSQL_DLL;HAS_POLARSSL_DLL;HAS_MBEDTLS_DLL;HAS_OPENSSL_DLL;HAS_ZLIB_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>acl_stdafx.hpp</PrecompiledHeaderFile>
@ -247,7 +247,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>.\include;..\lib_acl\include;..\lib_protocol\include;..\include\sqlite;..\include\mysql;..\include\pgsql;..\include\openssl-1.1.1q;..\include;.\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;_LIB;USE_WIN_ICONV;HAS_MYSQL_DLL;HAS_SQLITE_DLL;HAS_PGSQL_DLL;HAS_POLARSSL_DLL;HAS_MBEDTLS_DLL;HAS_ZLIB_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_LIB;USE_WIN_ICONV;HAS_MYSQL_DLL;HAS_SQLITE_DLL;HAS_PGSQL_DLL;HAS_POLARSSL_DLL;HAS_MBEDTLS_DLL;HAS_OPENSSL_DLL;HAS_ZLIB_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>acl_stdafx.hpp</PrecompiledHeaderFile>
@ -269,7 +269,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\include;..\lib_acl\include;..\lib_protocol\include;..\include\sqlite;..\include\mysql;..\include\pgsql;..\include\openssl-1.1.1q;..\include;.\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_LIB;_MT;ACL_DLL;ACL_CPP_DLL;ACL_CPP_EXPORTS;USE_WIN_ICONV;HAS_MYSQL_DLL;HAS_SQLITE_DLL;HAS_PGSQL_DLL;HAS_POLARSSL_DLL;HAS_MBEDTLS_DLL;HAS_ZLIB_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_LIB;_MT;ACL_DLL;ACL_CPP_DLL;ACL_CPP_EXPORTS;USE_WIN_ICONV;HAS_MYSQL_DLL;HAS_SQLITE_DLL;HAS_PGSQL_DLL;HAS_POLARSSL_DLL;HAS_MBEDTLS_DLL;HAS_OPENSSL_DLL;HAS_ZLIB_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -300,13 +300,13 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\include;..\lib_acl\include;..\lib_protocol\include;..\include\sqlite;..\include\mysql;..\include\pgsql;..\include\openssl-1.1.1q;..\include;.\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_LIB;_MT;ACL_DLL;ACL_CPP_DLL;ACL_CPP_EXPORTS;USE_WIN_ICONV;HAS_MYSQL_DLL;HAS_SQLITE_DLL;HAS_PGSQL_DLL;HAS_POLARSSL_DLL;HAS_MBEDTLS_DLL;HAS_ZLIB_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_LIB;_MT;ACL_DLL;ACL_CPP_DLL;ACL_CPP_EXPORTS;USE_WIN_ICONV;HAS_MYSQL_DLL;HAS_SQLITE_DLL;HAS_PGSQL_DLL;HAS_POLARSSL_DLL;HAS_MBEDTLS_DLL;HAS_OPENSSL_DLL;HAS_ZLIB_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>acl_stdafx.hpp</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
<ProgramDataBaseFileName>$(OutDir)$(ProjectName)_d.pdb</ProgramDataBaseFileName>
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
@ -331,7 +331,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\include;..\lib_acl\include;..\lib_protocol\include;..\include\sqlite;..\include\mysql;..\include\pgsql;..\include\openssl-1.1.1q;..\include;.\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;_LIB;_MT;ACL_DLL;HTTP_DLL;SMTP_DLL;ICMP_DLL;ACL_CPP_DLL;ACL_CPP_EXPORTS;USE_WIN_ICONV;HAS_MYSQL_DLL;HAS_SQLITE_DLL;HAS_PGSQL_DLL;HAS_POLARSSL_DLL;HAS_MBEDTLS_DLL;HAS_ZLIB_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_LIB;_MT;ACL_DLL;HTTP_DLL;SMTP_DLL;ICMP_DLL;ACL_CPP_DLL;ACL_CPP_EXPORTS;USE_WIN_ICONV;HAS_MYSQL_DLL;HAS_SQLITE_DLL;HAS_PGSQL_DLL;HAS_POLARSSL_DLL;HAS_MBEDTLS_DLL;HAS_OPENSSL_DLL;HAS_ZLIB_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@ -360,13 +360,13 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\include;..\lib_acl\include;..\lib_protocol\include;..\include\sqlite;..\include\mysql;..\include\pgsql;..\include\openssl-1.1.1q;..\include;.\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;_LIB;_MT;ACL_DLL;ACL_CPP_DLL;ACL_CPP_EXPORTS;USE_WIN_ICONV;HAS_MYSQL_DLL;HAS_SQLITE_DLL;HAS_PGSQL_DLL;HAS_POLARSSL_DLL;HAS_MBEDTLS_DLL;HAS_ZLIB_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_LIB;_MT;ACL_DLL;ACL_CPP_DLL;ACL_CPP_EXPORTS;USE_WIN_ICONV;HAS_MYSQL_DLL;HAS_SQLITE_DLL;HAS_PGSQL_DLL;HAS_POLARSSL_DLL;HAS_MBEDTLS_DLL;HAS_OPENSSL_DLL;HAS_ZLIB_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>acl_stdafx.hpp</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
<ProgramDataBaseFileName>$(OutDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>

View File

@ -201,7 +201,7 @@ bool openssl_io::open(ACL_VSTREAM* s)
SSL* ssl = __ssl_new(ctx);
if (!__ssl_set_fd(ssl, ACL_VSTREAM_SOCK(s))) {
if (!__ssl_set_fd(ssl, (int) ACL_VSTREAM_SOCK(s))) {
logger_error("SSL_set_fd error");
__ssl_free(ssl);
return false;
@ -322,7 +322,7 @@ int openssl_io::read(void* buf, size_t len)
return -1;
}
int ret = __ssl_read(ssl_, ptr, len);
int ret = __ssl_read(ssl_, ptr, (int) len);
if (ret > 0) {
nbytes += ret;
ptr += ret;
@ -387,7 +387,7 @@ int openssl_io::send(const void* buf, size_t len)
return -1;
}
int ret = __ssl_write(ssl_, ptr, len);
int ret = __ssl_write(ssl_, ptr, (int) len);
if (ret > 0) {
nbytes += ret;
ptr += ret;

View File

@ -346,7 +346,11 @@ ssize_t fiber_recv(FILE_EVENT *fe, void *buf, size_t len, int flags)
#if defined(HAS_IOCP)
if (EVENT_IS_IOCP(fiber_io_event())) {
# ifdef SYS_WIN
return (ssize_t) fiber_iocp_read(fe, buf, (int) len);
# else
return fiber_iocp_read(fe, buf, len);
# endif
}
#elif defined(HAS_IO_URING)
if (EVENT_IS_IO_URING(fiber_io_event())) {
@ -377,7 +381,11 @@ ssize_t fiber_recv(FILE_EVENT *fe, void *buf, size_t len, int flags)
}
#endif
#ifdef SYS_WIN
FIBER_READ(sys_recv, fe, buf, (int) len, flags);
#else
FIBER_READ(sys_recv, fe, buf, len, flags);
#endif
}
ssize_t fiber_recvfrom(FILE_EVENT *fe, void *buf, size_t len,
@ -387,7 +395,7 @@ ssize_t fiber_recvfrom(FILE_EVENT *fe, void *buf, size_t len,
#if defined(HAS_IOCP)
if (EVENT_IS_IOCP(fiber_io_event())) {
return fiber_iocp_read(fe, buf, len);
return fiber_iocp_read(fe, buf, (int) len);
}
#elif defined(HAS_IO_URING) && defined(IO_URING_HAS_RECVFROM)
if (EVENT_IS_IO_URING(fiber_io_event())) {
@ -420,5 +428,9 @@ ssize_t fiber_recvfrom(FILE_EVENT *fe, void *buf, size_t len,
}
#endif
#ifdef SYS_WIN
FIBER_READ(sys_recvfrom, fe, buf, (int) len, flags, src_addr, addrlen);
#else
FIBER_READ(sys_recvfrom, fe, buf, len, flags, src_addr, addrlen);
#endif
}

View File

@ -244,7 +244,11 @@ ssize_t fiber_send(FILE_EVENT *fe, const void *buf, size_t len, int flags)
CHECK_SET_NBLOCK(fe->fd);
while (1) {
#ifdef SYS_WIN
int n = (int) (*sys_send)(fe->fd, buf, (int) len, flags);
#else
int n = (int) (*sys_send)(fe->fd, buf, len, flags);
#endif
CHECK_WRITE_RESULT(fe, n);
}
@ -293,8 +297,13 @@ ssize_t fiber_sendto(FILE_EVENT *fe, const void *buf, size_t len,
CHECK_SET_NBLOCK(fe->fd);
while (1) {
#ifdef SYS_WIN
int n = (int) (*sys_sendto)(fe->fd, buf, (int) len, flags,
dest_addr, addrlen);
#else
int n = (int) (*sys_sendto)(fe->fd, buf, len, flags,
dest_addr, addrlen);
#endif
CHECK_WRITE_RESULT(fe, n);
}

View File

@ -226,7 +226,11 @@ ssize_t acl_fiber_recv(socket_t sockfd, void *buf, size_t len, int flags)
}
fe = fiber_file_open(sockfd);
#ifdef SYS_WIN
return (int) fiber_recv(fe, buf, len, flags);
#else
return fiber_recv(fe, buf, len, flags);
#endif
}
#ifdef SYS_WIN
@ -253,7 +257,12 @@ ssize_t acl_fiber_recvfrom(socket_t sockfd, void *buf, size_t len,
}
fe = fiber_file_open(sockfd);
#ifdef SYS_WIN
return (int) fiber_recvfrom(fe, buf, len, flags, src_addr, addrlen);
#else
return fiber_recvfrom(fe, buf, len, flags, src_addr, addrlen);
#endif
}
#ifdef SYS_UNIX
@ -385,7 +394,12 @@ ssize_t acl_fiber_send(socket_t sockfd, const void *buf, size_t len, int flags)
}
fe = fiber_file_open(sockfd);
#ifdef SYS_WIN
return (int) fiber_send(fe, buf, len, flags);
#else
return fiber_send(fe, buf, len, flags);
#endif
}
#ifdef SYS_WIN
@ -413,7 +427,12 @@ ssize_t acl_fiber_sendto(socket_t sockfd, const void *buf, size_t len,
}
fe = fiber_file_open(sockfd);
#ifdef SYS_WIN
return (int) fiber_sendto(fe, buf, len, flags, dest_addr, addrlen);
#else
return fiber_sendto(fe, buf, len, flags, dest_addr, addrlen);
#endif
}
#ifdef SYS_UNIX

View File

@ -304,7 +304,7 @@
<PreprocessorDefinitions>NDEBUG;_LIB;ACL_DLL;HTTP_DLL;HTTP_EXPORTS;ICMP_DLL;ICMP_EXPORTS;SMTP_DLL;SMTP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<ProgramDataBaseFileName>$(ProjectName).pdb</ProgramDataBaseFileName>
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<SDLCheck>false</SDLCheck>
</ClCompile>
@ -357,7 +357,7 @@
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<ProgramDataBaseFileName>$(ProjectName)_d.pdb</ProgramDataBaseFileName>
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<SDLCheck>false</SDLCheck>
</ClCompile>