mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-03 14:33:12 +00:00
8 lines
261 B
Nim
8 lines
261 B
Nim
|
|
|
||
|
|
proc alloc*(str: cstring): cstring =
|
||
|
|
# Byte allocation from the given address.
|
||
|
|
# There should be the corresponding manual deallocation with deallocShared !
|
||
|
|
let ret = cast[cstring](allocShared(len(str) + 1))
|
||
|
|
copyMem(ret, str, len(str) + 1)
|
||
|
|
return ret
|