OK, Richard, I tried your suggestion and it worked:
#define OSSL_CRYPTO_ALLOC
#define OSSL_DEPRECATEDIN_3_1
#include <openssl/bio.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
#define OSSL_DEPRECATEDIN_3_1
#include <openssl/bio.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
On Sat, Aug 19, 2023 at 6:37 AM Don Payette <payettedon@xxxxxxxxx> wrote:
Nope. I changed macros.h from:# ifndef OSSL_CRYPTO_ALLOC
# if defined(__GNUC__)
# define OSSL_CRYPTO_ALLOC __attribute__((malloc))
# elif defined(_MSC_VER)
# define OSSL_CRYPTO_ALLOC __declspec(restrict)
# else
# define OSSL_CRYPTO_ALLOC
# endif
# endifto:# ifndef OSSL_CRYPTO_ALLOC
# if defined(__GNUC__)
# define OSSL_CRYPTO_ALLOC __attribute__((malloc))
# elif defined(_MSC_VER)
# define OSSL_CRYPTO_ALLOC
# else
# define OSSL_CRYPTO_ALLOC
# endif
# endifOn Sat, Aug 19, 2023 at 12:45 AM Richard Levitte <levitte@xxxxxxxxxxx> wrote:It should be possible to have this define in your code before including any openssl header:
#define OSSL_CRYPTO_ALLOC
Is that what you did?
Cheers
RichardDon Payette <payettedon@xxxxxxxxx> skrev: (19 augusti 2023 04:58:13 CEST)Well, I did some experimenting. I changedOSSL_CRYPTO_ALLOC void *CRYPTO_malloc(size_t num, const char *file, int line);tovoid *CRYPTO_malloc(size_t num, const char *file, int line);And it compiled. I tried changing the OSSL_CRYPTO_ALLOC define to define it as blank. But that still gets a syntaxerror saying it expects a ";" before the "void *". That seems odd to me.Don Payette(cell) 479-216-6320On Tue, Aug 15, 2023 at 9:01 AM Don Payette <payettedon@xxxxxxxxx> wrote:I'm converting an existing Winsock app to have encryption by using OpenSSL.I'm getting syntax errors attempting to compile my app. My environment is Microsoft Visual C++.I downloaded and installed the OpenSSL pre-compiled binaries and added the following to the Include Directories.C:\Program Files\OpenSSL-Win64\includesIn my existing Socket.cpp file I added OpenSSL includes:#include <stdio.h>#include <string.h>#include <openssl/bio.h>#include <openssl/ssl.h>#include <openssl/err.h>#include <signal.h>
Severity Code Description Project File Line
Error (active) E0077 this declaration has no storage class or type specifier DFDS C:\Program Files\OpenSSL-Win64\include\openssl\crypto.h 344Error (active) E0065 expected a ';' DFDS C:\Program Files\OpenSSL-Win64\include\openssl\crypto.h 344OSSL_CRYPTO_ALLOC void *CRYPTO_malloc(size_t num, const char *file, int line);The definition of OSSL_CRYPTO_ALLOC is in macros.h:# ifndef OSSL_CRYPTO_ALLOC# if defined(__GNUC__)# define OSSL_CRYPTO_ALLOC __attribute__((malloc))# elif defined(_MSC_VER)# define OSSL_CRYPTO_ALLOC __declspec(restrict)# else# define OSSL_CRYPTO_ALLOC# endif# endifI figure it is using the _MSC_VER define, which is the __declspec one.Any ideas what it is complaining about?Don Payette(cell) 479-216-6320