freenode/#lisp - IRC Chatlog
Search
4:04:58
Josh_2
bit of a pita that I'm not longer using with-foreign-string as that automatically freed pointers
4:07:56
Nilby
Josh_2: You might be able to use with-foreign-object, but really either way it's just an unwind protect wrapper.
4:59:18
mfiano
I recently took a break from game development, after approximately 20 years. I'm really having a lot of fun developing another project with Common Lisp.
5:00:36
mfiano
I've been writing a game engine/games in CL for about 15, but my burnout meter said I needed a break.
5:13:13
mfiano
I started a rather ambitious project that requires performance and interactive development, so Common Lisp makes perfect sense. But it's in its infancy, only about 10kloc so far.
5:19:52
mfiano
It will be a library and end-user application for procedurally generating images such as abstract art or 3D textures than can wrap a game actor using math. Their is another project, called WEIR, which is a similar yet with a very different, limited use-case.
5:23:31
mfiano
So far I have about 25 coherent noise algorithms and a bunch of transformations you can apply to them in a graph. Not much, but yes, it is ambitious. I made this example the other day with the limited tools I have implemented: https://i.lisp.cl/temp/art.png
5:28:01
mfiano
One day you might be able to drag graph nodes and connect transformer edges to each other and see results in real time outside of Emacs :)
13:50:01
Josh_2
cffi is causing my program to hang when I attempt to free a pointer created with (with-pointer-to-vector-data ..)
13:54:54
Nilby
with-pointer-to-vector-data is not without problems, because to be safe on has to not have garbage collection happen while C is using it
13:56:09
Josh_2
with-pointer-to-vector-data performs perfectly and I get the expected result I just can't free the pointer
13:59:37
Nilby
with-pointer-to-vector-data is just giving the lisp pointer to C code. with-foreign-string , with-foregin-object, etc. allocates and frees non-gc memory so it's safer
14:00:12
Nilby
with-pointer-to-vector-data is kind of a hack to make things fast, and zero copy when you know it's safe to do
14:01:15
Josh_2
well if I'm within the body of (with-pointer-to-vector-data .. it won't garbage collect the buffer will it?
14:02:14
Nilby
perhaps, as long as long as you stay in C code, and gc doesn't happen from another thread or something
14:05:29
Nilby
You're welcome, I've probably done too much with CFFI for my own good. The problems with with-pointer-to-vector-data is probably why it isn't mentioned in the manual.
14:16:46
Nilby
Lisp by itself is usually pretty safe, but With proper application of CFFI and other CL things I've managed to make Lisp crash itself, the window it's in, the window system, the OS, and even make the hardware overheat and break.
14:22:41
Nilby
It should usually convert automaticlly, but if it doesn't you can use cffi:translate-from-foreign
14:29:59
Josh_2
well the C function takes an argument of type uint32_t *, so I (foreign-alloc :uint32) as pass that, but it isn't being converted back to a nice integer
14:32:30
francogrex
heisig: ok I suppose it was more trial and error (because I haven't seen any sort of comprehensive manual) yet
14:43:39
Josh_2
Now I just have to figure out why when I encrypt "test" and then decrypt it i get "test ... " followed by a bunch of random characters like #\Return
14:47:10
Nilby
Josh_2: Maybe there's a uint8 zero before those which C thinks should stop you, but Lisp is like whatever.