memchr seems to have a bug on recent Linux systems if the count that is passed in is larger than the buffer (in our specific case the count is -1 to find the 0 byte of \0 terminated strings): the function "randomly" fails to find the byte and returns zero thus leading to for example incorrect parameter handling.
rtl/inc/cgeneric.inc:
* use rawmemchr on Linux if -1 is passed as count
git-svn-id: trunk@30160 -
sizeint" function that returns:
<0: invalid sequence detected after processing "-result" bytes
0: incomplete (may still be valid if MaxLookAhead is increased)
>0: sequence of result bytes forms a codepoint (+ combining diacritical
marks if that parameter was true)
git-svn-id: trunk@30047 -
* Unit finalization executes arbitrarily large amount of code. Doing it when error occurred can cause
other errors, overwriting the original error information.
* Code that prints error message depends on everything and a kitchen sink (most notably, Unicode manager
and lineinfo unit). Running it after finalizing units can be successful only by coincidence.
* Last but not least, this sequence (ExitProc -> print RTE -> finalize units) is same as one used in Delphi.
git-svn-id: trunk@29733 -
Each port that allows the usage of dynamic libraries should call InitSystemDynLibs during initialization of the System unit.
The DynLibs unit has been adjusted to be a forwarder for the functions that now reside in the System unit (for backwards compatiblity just in case). Additionally the unit will register the DynLibsManager if it doesn't reside in the System unit anyway.
Currently only the Windows targets (Win32, Win64 and WinCE) implement the DynLibsManager inside the System unit. For other systems using the LoadLibrary, etc. functions will lead to a run error/exception.
If a port wants to implement its own DynLibsManager then it needs to define DISABLE_NO_DYNLIBS_MANAGER. TLibHandle, NilHandle and optionally TOrdinalEntry (it's set to SizeUInt otherwise) should be defined in sysdlh.inc which needs to be enabled using the define FPC_SYSTEM_HAS_SYSDLH (because there are targets which have FEATURE_DYNLIBS enabled, but don't support them... e.g. powerpc-wii -.-).
The DynLibsManager contains methods for loading a library based on a RawByteString and based on a UnicodeString. BOTH should be implemented, but internally one can forward to the other.
The loading by ordinal *can* be be implemented. If it is set to Nil then the implementation of GetProcAddress(lib,ordinal) will return Nil.
+ new functions SetDynLibsManager and GetDynLibsManager to set and retrieve the current DynLibsManager
* provide interface of DynLibs unit in unit System
git-svn-id: trunk@29613 -
fpc_ansistr_to_widechararray(), so that CP_ACP/CP_OEM etc are properly
handled (fixes assign/assignfile with non-ansi characters in source files
that don't explicitly specify the code page)
git-svn-id: trunk@29218 -
builder
o removed variant record part in the RTL to force a specific size/alignment,
since we now import the record into the compiler and hence it will always
be handled correctly
git-svn-id: branches/hlcgllvm@28777 -