Improve cross-compiler portability of applink.c module and mention
authorAndy Polyakov <appro@openssl.org>
Wed, 9 Nov 2005 17:11:03 +0000 (17:11 +0000)
committerAndy Polyakov <appro@openssl.org>
Wed, 9 Nov 2005 17:11:03 +0000 (17:11 +0000)
CRYPTO_malloc_init in FAQ.

FAQ
ms/applink.c

diff --git a/FAQ b/FAQ
index c40e7e5f66090a0a1a90e735f46ee8cc8d9e926d..889eb0ac43bc0322a198c86796c5225243376854 100644 (file)
--- a/FAQ
+++ b/FAQ
@@ -710,16 +710,19 @@ Note that debug and release libraries are NOT interchangeable.  If you
 built OpenSSL with /MD your application must use /MD and cannot use /MDd.
 
 As per 0.9.8 the above limitation is eliminated for .DLLs. OpenSSL
 built OpenSSL with /MD your application must use /MD and cannot use /MDd.
 
 As per 0.9.8 the above limitation is eliminated for .DLLs. OpenSSL
-.DLLs compiled with some specific run-time option [we recommend the
+.DLLs compiled with some specific run-time option [we insist on the
 default /MD] can be deployed with application compiled with different
 option or even different compiler. But there is a catch! Instead of
 re-compiling OpenSSL toolkit, as you would have to with prior versions,
 you have to compile small C snippet with compiler and/or options of
 your choice. The snippet gets installed as
 <install-root>/include/openssl/applink.c and should be either added to
 default /MD] can be deployed with application compiled with different
 option or even different compiler. But there is a catch! Instead of
 re-compiling OpenSSL toolkit, as you would have to with prior versions,
 you have to compile small C snippet with compiler and/or options of
 your choice. The snippet gets installed as
 <install-root>/include/openssl/applink.c and should be either added to
-your project or simply #include-d in one [and only one] of your source
-files. Failure to do either manifests itself as fatal "no
-OPENSSL_Applink" error.
+your application project or simply #include-d in one [and only one]
+of your application source files. Failure to link this shim module
+into your application manifests itself as fatal "no OPENSSL_Applink"
+run-time error. An explicit reminder is due that in this situation
+[mixing compiler options] it is as important to add CRYPTO_malloc_init
+prior first call to OpenSSL.
 
 * How do I read or write a DER encoded buffer using the ASN1 functions?
 
 
 * How do I read or write a DER encoded buffer using the ASN1 functions?
 
index e2d066bc1ec24d7e243ce1ff1d836b8028ed0d26..54a0a642628a25c6a5a0909c2b50174c22f5052d 100644 (file)
@@ -39,7 +39,20 @@ static int   app_fileno(FILE *fp)    { return _fileno(fp); }
 static int   app_fsetmod(FILE *fp,char mod)
 { return _setmode (_fileno(fp),mod=='b'?_O_BINARY:_O_TEXT); }
 
 static int   app_fsetmod(FILE *fp,char mod)
 { return _setmode (_fileno(fp),mod=='b'?_O_BINARY:_O_TEXT); }
 
-__declspec(dllexport) void **OPENSSL_Applink(void)
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+__declspec(dllexport)
+void **
+#if defined(__BORLANDC__)
+__stdcall      /* __stdcall appears to be the only way to get the name
+                * decoration right with Borland C. Otherwise it works
+                * purely incidentally, as we pass no parameters. */
+#else
+__cdecl
+#endif
+OPENSSL_Applink(void)
 { static int once=1;
   static void *OPENSSL_ApplinkTable[APPLINK_MAX+1]={(void *)APPLINK_MAX};
 
 { static int once=1;
   static void *OPENSSL_ApplinkTable[APPLINK_MAX+1]={(void *)APPLINK_MAX};
 
@@ -74,4 +87,8 @@ __declspec(dllexport) void **OPENSSL_Applink(void)
 
   return OPENSSL_ApplinkTable;
 }
 
   return OPENSSL_ApplinkTable;
 }
+
+#ifdef __cplusplus
+}
+#endif
 #endif
 #endif