freenode/#lisp - IRC Chatlog
Search
4:43:24
emaczen
I have a lisp function whose argument gets passed to a particular cffi:foreign-funcall which expects a struct
4:43:49
emaczen
The "struct" I pass to the lisp function gets automatically translated into a lisp list
4:45:30
emaczen
How do I stop this automatic translation, or how can I force the list to be converted back to a struct?
5:43:12
LdBeth
emaczen: then just use the ctype pointer, see https://common-lisp.net/project/cffi/manual/cffi-manual.html#Foreign-Structure-Types
8:13:28
Nilby
Grue: Probably because it wants you to use #'cddr, maybe to prevent against 'something as a typo.
8:17:22
beach
Grue`: I think it means that it is going to call FDEFINITION, perhaps in each iteration.
8:33:55
Grue`
I actually avoid using #' in my code for various reasons, so this warning was annoying
8:40:08
Grue`
' always uses top level function definition, so for example if I'm calling a function in a macro expansion I'm immune to it being redefined in flet
8:42:41
Grue`
yeah, standard functions get ' for consistency. basically I only use #' for lexical scope functions
8:50:43
Grue`
there's literally no difference in (disassemble (lambda (y) (funcall 'cddr y))) whether I uuse #' or '. So the compiler probably realizes that just means (cddr y)
8:59:26
jackdaniel
it might be that optimization of "locked" funcitons is in independent module and happens much later
10:31:36
akr
so if you pass example@example.com as the envelope, cl-smtp tries to use <example@example.com>
10:33:10
akr
the problem seems to be here: https://gitlab.common-lisp.net/cl-smtp/cl-smtp/blob/master/cl-smtp.lisp#L398
10:37:19
akr
#<SMTP-PROTOCOL-ERROR a command failed:\\ncommand: \\\"MAIL FROM:noreply@domain.eu\\\" expected: 250 response-code: 555 response-message: 5.5.2 Syntax error. w3sm148620wrp.51 - gsmtp>
10:37:21
akr
#<SMTP-PROTOCOL-ERROR a command failed:\\ncommand: \\\"MAIL FROM:noreply@domain.eu\\\" expected: 250 response-code: 555 response-message: 5.5.2 Syntax error. w3sm148620wrp.51 - gsmtp>
10:44:45
akr
there was a problem with my envelope which I fixed and then there was a problem with Google SMTP denying our requests doe to wrong IP or somesuch
10:47:55
beach
prite: There are two common ways, either "see loss" or "kloss". I use the former. I know nobody to pronounces each individual letter.
11:21:50
jackdaniel
some pronouce it c-loss, as an ultimate argument in favor of Common Lisp (and not for C). of course it sounds all the same, but it is the feeling you put into words what counts here ,)
15:32:29
MichaelRaskin
Well, a lot of fun is not really planned. There are just around 5 or 10 repos that are not business logic but relatively general libraries
15:33:17
MichaelRaskin
Most of them don't even change much, because next layer of code depends on them and they just work more or less fine as they are
15:34:20
MichaelRaskin
Just a generally good idea to have previously published code mentioned at ELS available at Common-Lisp.net; so not fun, just adding a few lines to a list of repos to mirror
15:41:47
drmeister
What's the deal? Do I implement something like a simple-vector for simple data types where I keep a pointer to an arbitrary location in memory?
15:42:00
phoe
AFAIK you need to ensure that they are never garbage-collected (unless you free them manually) and that they are never moved
15:42:37
phoe
and once that happens, these vectors are static - they don't move, they aren't GC-managed, you can get a pointer to their storage and send it to C code
15:43:04
phoe
and once the C code returns, you can access the same data in Lisp by using the vector reference that you created when you created the static vector
15:43:47
drmeister
Ok, that's one thing - but can the data be stored anywhere in memory? If it can - then I need to have a GC managed object that contains an indirection to the data that can be stored anywhere.
15:44:28
drmeister
In Clasp there is GC managed memory and then there is C/malloc/C++/new managed memory.
15:45:31
phoe
they are the equivalent of calling standard malloc - you get some memory that won't ever move, and you can reference that memory all over your program.
15:45:36
drmeister
Say I call a C function and it allocates an array of double values and returns a pointer to that data to me. Do I want to be able to then create a static-vector that points to that data?
15:47:20
drmeister
If I do point into C++/C memory - then I need an object in GC memory that points to that C++/C memory and all static-vector accesses are through that indirection.
15:48:03
phoe
You can't allocate the vector's storage in C and then use it in Lisp to create a vector from it.
15:49:23
drmeister
Then I could implement static-vectors by simply allocating our current simple vectors of simple types in a non-moving pool.
15:50:14
drmeister
That means I just need to add some creator functions that use the non-moving pool allocator rather than the moving pool allocation in MPS.
15:50:54
drmeister
Well, I need to create an interface that for boehm will do nothing more than it already does.
15:52:15
drmeister
But it's always Common Lisp that allocates the memory and passes the pointer to the non-moving memory to the C or C++ code. It's NEVER the C or C++ code that allocates memory and tells Common Lisp where it is.
15:53:06
drmeister
Static vectors have come up again and again - and now with the netcdf stuff it looks like I really need them.
16:26:23
phoe
No no, I didn't mean that one - I thought that with your goal of bonding C++ and CL, you would have needed them much earlier.