Subject: | SSLeay.xs line 1766 assumes ANSI C99 compiler |
When building Net-SSLeay-1.41, I got a compile error with Net-SSLeay.c
when building on Windows with MSVC6 with a very odd compiler error message:
SSLeay.xs(1766) : error C2275: 'FILE' : illegal use of this type as an
expression
Digging further, I noticed that the change to SSLeay.xs introduced in
Net-SSLeay-1.37 is assuming ANSI C99 in function CTX_use_PKCS12_file()
in that in:
CODE:
RETVAL = 1;
FILE *fp = fopen (file, "r");
The declaration of fp occurs after "RETVAL = 1".
The following simple re-ordering fixed my compilation problem:
--- SSLeay-orig.xs 2011-09-25 07:09:07.000000000 +1000
+++ SSLeay.xs 2011-10-03 15:51:07.000000000 +1100
@@ -1760,10 +1760,11 @@
EVP_PKEY* private_key;
X509* certificate;
SSL_CTX * ctx1;
+ FILE *fp;
CODE:
RETVAL = 1;
- FILE *fp = fopen (file, "r");
+ fp = fopen (file, "r");
bio = BIO_new(BIO_s_mem());
while(count = fread(buffer, 1, sizeof(buffer), fp))
BIO_write(bio, buffer, count);