lib/asn1: gen require ASN1_LIB be defined on Windows when compiling

Instead of defining ASN1_LIB in each of the generated ASN1 source
files require that the generated source file be compiled with the
ASN1_LIB symbol defined (on Windows).  All of the compiled objects
linked into the same library which might be accessing an ASN1 exported
symbol must have ASN1_LIB defined to ensure that the use of the
exported symbols will not be via an import.

Change-Id: Ie38c105d1d376419717fce0830dc28f5b82547d4
This commit is contained in:
Jeffrey Altman
2022-01-05 12:18:50 -05:00
committed by Nico Williams
parent 4f4d1a0288
commit 6694f98791

View File

@@ -427,7 +427,9 @@ generate_header_of_codefile(const char *name)
fprintf (codefile,
"/* Generated from %s */\n"
"/* Do not edit */\n\n"
"#define ASN1_LIB\n\n"
"#if defined(_WIN32) && !defined(ASN1_LIB)\n"
"# error \"ASN1_LIB must be defined\"\n"
"#endif\n"
"#include <stdio.h>\n"
"#include <stdlib.h>\n"
"#include <time.h>\n"