I cannot import malloc/malloc.h
to use malloc_size()
to see the size of an object. Is it available in Swift
or am I doing it wrong: import malloc/malloc.h
The Unix/POSIX stuff is all in the Darwin
module.
import Darwin
let r = rand()
qsort_b(buffer, 0, 10, sortFunc)
malloc
is in there, too, but it won't do you much good — it returns an opaque pointer.
Have you looked into using a bridging header?
Create a .h file named -Bridging-Header-File.h Then reference it in your projects build settings (under "Swift Compiler" look for "Objective C Bridging Header") with:
$(SRCROOT)/<Your-Project-Name>-Bridging-Header.h
Now malloc_size() should be available
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With