Tobias Rapp wrote: > Arno Garrels wrote: >> The DLL names are globally writable typed constants, set their values >> before the OpenSSL libraries are loaded. > > Is there any advantage to use writable typed constants like > > const GSSLEAY_DLL_Name : String = 'SSLEAY32.DLL'; > > instead of > > var GSSLEAY_DLL_Name : String = 'SSLEAY32.DLL';
There is no advantage IMO. According to the documentation they are "in essence initialized variables" and "In early versions of Delphi and Object Pascal, typed constants were always writeable, corresponding to the {$J+} state. Old source code that uses writeable typed constants must be compiled in the {$J+} state, but for new applications it is recommended that you use initialized variables and compile your code in the {$J-} state." > > Both seems to work but I try to avoid the first one whenever possible > because it can break multi-threading when not used properly. For > example I had a commercial component that contained code like this to > save some code lines: > > procedure SomeProc(); > {$J+} // enable writeable consts > const > Buffer : array[0..31] of byte = (0, 0, ..., 0); > {$J-} // disable writeable consts > begin > // read and write to Buffer like it's a variable > end; > > which caused problems when the procedure is used by different threads > simultaneously because all instances read and write to the same block > in memory. Yes, but no problem in this case since you should write the DLL names just once. -- Arno Garrels -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be