freenode/#lisp - IRC Chatlog
Search
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.
19:03:01
dbotton
Is there a way to execute a command from asdf? So that so when someone does a quicklisp load of my project it runs a git command to git clone a JS component?
19:10:15
_death
dbotton: see https://www.common-lisp.net/project/asdf/asdf.html#The-object-model-of-ASDF
19:11:13
pfdietz
I see some LZW compression algorithms in QL, but is there one by itself intended for general use?
19:11:47
pfdietz
Xach: you wrote on in skippy, but it doesn't appear to be part of the exported interface of that system.
19:12:53
Alfr_
dbotton, could you declare a dependency on that component in the readme instead of trying to retrieve it on every load-system?
19:17:35
Xach
The simplest thing (on a certain axis) is to include all the things you need up front.
19:25:38
Xach
pfdietz: are you interested in a standalone library for lzw for something in particular?
19:32:17
dbotton
So maybe I just describe in demo how if the CDN version fails (or your country can't use) what to do
19:33:17
dbotton
I don't think I want to add into my git tree and don't really want it as a dependency
19:51:16
White_Flame
dbotton: btw, uoip is a part of asdf, so if you're loading via asdf, you shouldn't have to check if it's there
19:53:29
Xach
having uiop does not mean the things you may want to run will be present and run, though.
19:54:24
White_Flame
oh, I thought the implication was testing if uiop was present, might have misread
23:01:40
didi
People, people. Hear me: use `with-standard-io-syntax' when printing sexps to a file and save yourself from the pain.