Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The value PZMQ::FREE-FN is not of type SB-SYS:SYSTEM-AREA-POINTER #19

Open
phoe opened this issue May 24, 2019 · 1 comment
Open

The value PZMQ::FREE-FN is not of type SB-SYS:SYSTEM-AREA-POINTER #19

phoe opened this issue May 24, 2019 · 1 comment

Comments

@phoe
Copy link
Contributor

phoe commented May 24, 2019

(defcallback free-fn :void ((data :pointer) (hint :pointer))
  (declare (ignorable hint))
  (foreign-string-free data))

(defun msg-init-data (msg data)
  "Initialise ØMQ message from a supplied buffer.
@see{MSG-CLOSE}
@see{MSG-INIT-SIZE}
@see{MSG-INIT-DATA}"
  (let ((ptr (foreign-string-alloc data)))
    (with-c-error-check (:int)
      (%msg-init-data msg ptr (length data) 'free-fn nil))))

In this code, %msg-init-data refers to a callback named free-fn. The symbol does not get translated into the callback pointer though, which causes the following error:

The value
  PZMQ::FREE-FN
is not of type
  SB-SYS:SYSTEM-AREA-POINTER
when binding SB-ALIEN::VALUE
   [Condition of type TYPE-ERROR]

Restarts:
 0: [RETRY] Retry SLIME REPL evaluation request.
 1: [*ABORT] Return to SLIME's top level.
 2: [ABORT] abort thread (#<THREAD "repl-thread" RUNNING {1001F11B63}>)

Backtrace:
  0: (PZMQ::%MSG-INIT-DATA #.(SB-SYS:INT-SAP #X7FB249097F78) #.(SB-SYS:INT-SAP #X7FB240003580) 6 PZMQ::FREE-FN NIL)
  1: (PZMQ:MSG-INIT-DATA #.(SB-SYS:INT-SAP #X7FB249097F78) "World!")
  2: (HWSERVER "tcp://*:5555")
  3: (SB-INT:SIMPLE-EVAL-IN-LEXENV (HWSERVER) #<NULL-LEXENV>)
  4: (EVAL (HWSERVER))
@phoe
Copy link
Contributor Author

phoe commented May 24, 2019

Possible fix: replace 'free-fn with (cffi:callback free-fn), and the null hint argument with (cffi:null-pointer).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant