On 07 Jun 2010, at 17:11, José Mejuto wrote: > Wow, that looks "dangerous" at least it should produce a warning when > used in interfaces, or as safecall is a form of stdcall (with return > values check) replace by stdcall.
Yes, probably. The reason was that nobody knew that this calling convention made any sense at all on non-Windows platforms, so its appearance was assumed to be a porting artefact. > JM> At first sight that does not happen in XPCOM, even on Windows (but > JM> since we do it on Windows, maybe we should also do it elsewhere for > JM> consistency reasons). > > Maybe, but that's not a great problem, maybe do it only in the case of > "Verify method calls" ? Only if it's only done on Windows in that case as well. > JM> b) a lot of people use Pascal "const" as translation for C's "const *" > JM> for record parameters, which is wrong (but which sometimes works by > JM> accident) > > Yes, but removing the "const" still passes the parameter as 16 bytes, > and defining it as "var" creates problems when passing an interface to > extract the GUID instead passing the interface reference. Anyway most > of this problems are quite easy to be bypassed with some source > changes which still remain compatible between windows and linux. In such cases, the parameter should be a pointer. It's probably "const" for Delphi compatibility (which probably guarantees passing const records by reference for safecall, and hence FPC probably also does on platforms that support it). > JM> I'm personally not really interested in fixing this whole mess though. > JM> I spend a lot of time in the past disabling safecall in the compiler > JM> for all non-Windows platforms because it always generated wrong code > JM> elsewhere. Now it seems it should be > JM> a) enabled everywhere, and then > JM> b) fixed for all platforms, which requires modification to the > JM> parameter managers of most architectures (since most don't contain any > JM> support for safecall) > > That looks as a hard job :( I can only help testing XPCOM in both > windows and linux, but I doubt that I can help in the compiler side :( You should file a bug report. Jonas_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal