Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
test CPPBridge on macos
c := CPPBridge .
fdNumber := c openFile: '/Users/kilon/cpptest.bin'
flags: (c O_RDWR "| c O_CREAT | c O_TRUNC")
mode: (c FILEMODE).
"lseek := c lSeek_fd: fdNumber range:3999 value:0.
c write_fd:fdNumber value: '' size: 1."
mmapPointer := c mmap_adress: 0
fileSize:4000
flag1: (c PROT_READ | c PROT_WRITE )
flag2: (c MAP_SHARED)
fd: fdNumber
offset: 0 .
memset := c memset_startAddress: (mmapPointer )
value: 0
size: 3004.
mmapPointer getHandle floatAt:1 put: 1.3 .
mmapPointer getHandle floatAt:5 put: 200.3 .
1 to: 10 do: [:time| 1 to: 150 do:[ :each| mmapPointer getHandle floatAt:9 put: (each * 1.1 ). 0.01 asSeconds wait.]].
0.01 asSeconds
c munmap_data: mmapPointer filesize: 4000.
c closeFile: fd.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.