C Standard Library¶
malloc(size::Integer) → Ptr{Void}¶Call
mallocfrom the C standard library.
calloc(num::Integer, size::Integer) → Ptr{Void}¶Call
callocfrom the C standard library.
realloc(addr::Ptr, size::Integer) → Ptr{Void}¶Call
reallocfrom the C standard library.See warning in the documentation for
freeregarding only using this on memory originally obtained frommalloc.
free(addr::Ptr)¶Call
freefrom the C standard library. Only use this on memory obtained frommalloc, not on pointers retrieved from other C libraries.Ptrobjects obtained from C libraries should be freed by the free functions defined in that library, to avoid assertion failures if multiplelibclibraries exist on the system.
errno([code])¶Get the value of the C library’s
errno. If an argument is specified, it is used to set the value oferrno.The value of
errnois only valid immediately after accallto a C library routine that sets it. Specifically, you cannot callerrnoat the next prompt in a REPL, because lots of code is executed between prompts.
strerror(n=errno())¶Convert a system call error code to a descriptive string
GetLastError()¶Call the Win32
GetLastErrorfunction [only available on Windows].
FormatMessage(n=GetLastError())¶Convert a Win32 system call error code to a descriptive string [only available on Windows].
time(t::TmStruct)¶Converts a
TmStructstruct to a number of seconds since the epoch.
strftime([format, ]time)¶Convert time, given as a number of seconds since the epoch or a
TmStruct, to a formatted string using the given format. Supported formats are the same as those in the standard C library.
strptime([format, ]timestr)¶Parse a formatted time string into a
TmStructgiving the seconds, minute, hour, date, etc. Supported formats are the same as those in the standard C library. On some platforms, timezones will not be parsed correctly. If the result of this function will be passed totimeto convert it to seconds since the epoch, theisdstfield should be filled in manually. Setting it to-1will tell the C library to use the current system settings to determine the timezone.
TmStruct([seconds])¶Convert a number of seconds since the epoch to broken-down format, with fields
sec,min,hour,mday,month,year,wday,yday, andisdst.
flush_cstdio()¶Flushes the C
stdoutandstderrstreams (which may have been written to by external C code).
msync(ptr, len[, flags])¶Forces synchronization of the
mmap()ped memory region fromptrtoptr+len. Flags defaults toMS_SYNC, but can be a combination ofMS_ASYNC,MS_SYNC, orMS_INVALIDATE. See your platform man page for specifics. The flags argument is not valid on Windows.You may not need to call
msync, because synchronization is performed at intervals automatically by the operating system. However, you can call this directly if, for example, you are concerned about losing the result of a long-running calculation.
MS_ASYNC¶Enum constant for
msync(). See your platform man page for details. (not available on Windows).