freenode/#sbcl - IRC Chatlog
Search
1:55:56
no-defun-allowed
Every time I see a paste like that I wonder why you don't just use C, admittedly.
1:55:56
no-defun-allowed
But as for lines 7-10, you don't need to coerce the Lisp string (a vector) to another vector to iterate using LOOP's ACROSS, and lines 13 and 16 refer to different structures.
1:56:44
no-defun-allowed
I'm not sure what you expect to get reading from an uninitialised slot of an alien structure. No memory fault even?
1:58:53
no-defun-allowed
When I run it, I see NIL, probably cause there is a null pointer instead of a value as that refers to a different (STRUCT STUDENT) structure.
1:59:31
no-defun-allowed
Try (let ((s (make-alien (struct student3)))) (setf (deref (slot s 'name) 0) "hi") (deref (slot s 'name) 0))
2:02:48
asdf_asdf_asdf
OK. But I want change globally values struct student3, that was visible outside the let or (with-alien...
2:51:20
no-defun-allowed
define-alien-variable attempts to access a variable in...well, I could call it the "C" namespace.
2:52:33
no-defun-allowed
If you had practised using Lisp for things other than making C structures, you would probably notice that DEFVAR or DEFPARAMETER is used to define variables, and those can store alien structures on SBCL.
2:55:09
no-defun-allowed
(defvar *structure* (make-alien (struct student3))) (setf ..... set the slots here ...) (print (deref (slot *structure* 'slot-name) 0))
2:57:35
asdf_asdf_asdf
Thank you, but is other fashion/manner to set value slot and next refer to maked instance?
3:00:48
asdf_asdf_asdf
I want set (setf (deref (slot (make-alien (struct student3)) 'name) 0) "Hello World.") and next (print (slot (refer-to-maked-alien student3) 'name)).
3:07:51
no-defun-allowed
There's probably a lot of other things you could do, but I would really use a variable.
3:12:05
no-defun-allowed
I can't think of any ways to do that. It would probably lead to messy code if you did, too.
3:34:51
aeth
no-defun-allowed: Iirc, unless it has changed, asdf wants to manually wrap some subset of the WinAPI in non-portable SBCL FFI. Why? Who knows.
7:45:15
kpoeck
cross compiling sbcl with clasp I now get "Symbol named "SINGLE-FLOAT-VALUE-SLOT" not found in the SB-VM package" in genesis.lisp. Perhaps another error with clasp reader.
8:03:57
no-defun-allowed
It doesn't exist on SBCL 2.0.0.8 on x86_64 here, and it seems to only be used by the other architectures. What arch are you compiling from?