From: Rick T. <ta...@ui...> - 2005-11-26 18:52:00
|
hi, I have a CFFI interface to Portmidi that works great in CLISP 3.35/OSX and Im trying to get it working on CLISP 3.35/WIN32 too. However, im having a problem because (ffi::foreign-library :default) is returning a null foreign pointer even though CFFI:LOAD-FOREIGN-LIBRARY is returning a valid pointer to the library when the library is loaded. Any ideas what is going wrong or how i can fix it? Im using the binary CLISP release from sourceforge. --rick taube |
From: Sam S. <sd...@gn...> - 2005-11-26 23:02:28
|
> * Rick Taube <gnhor@hvhp.rqh> [2005-11-26 12:51:48 -0600]: > > hi, I have a CFFI interface to Portmidi that works great in CLISP > 3.35/OSX and Im trying to get it working on CLISP 3.35/WIN32 > too. However, im having a problem because (ffi::foreign-library > :default) is returning a null foreign pointer even though > CFFI:LOAD-FOREIGN-LIBRARY is returning a valid pointer to the library > when the library is loaded. Any ideas what is going wrong or how i can > fix it? Im using the binary CLISP release from sourceforge. why are you calling (ffi::foreign-library ...) explicitly? def-call-out and def-c-var will call it for you. -- Sam Steingold (http://www.podval.org/~sds) running w2k http://ffii.org/ http://www.memri.org/ http://truepeace.org http://www.palestinefacts.org/ http://pmw.org.il/ The world will end in 5 minutes. Please log out. |
From: Rick T. <ta...@ui...> - 2005-11-27 00:05:27
|
> why are you calling (ffi::foreign-library ...) explicitly? > def-call-out and def-c-var will call it for you. Im not calling it explicitly, CFFI (cffi-luis-051114-1956) expands to it, for whatever reason. This is my code: (cffi:defcfun ("Pm_Initialize" pm-initialize) pm-error) Macroexpanding it (on my osx machine where i am now) gives me: (macroexpand '(cffi:defcfun ("Pm_Initialize" pm-initialize) pm-error)) ==> (PROGN NIL (DEFUN PM-INITIALIZE NIL (CFFI::TRANSLATE-OBJECTS NIL NIL NIL PM-ERROR (CFFI-SYS:%FOREIGN-FUNCALL "Pm_Initialize" :INT)))) and then (macroexpand '(CFFI-SYS:%FOREIGN-FUNCALL "Pm_Initialize" :INT)) ==> (FUNCALL (LOAD-TIME-VALUE (FFI::FOREIGN-LIBRARY-FUNCTION "Pm_Initialize" (FFI::FOREIGN-LIBRARY :DEFAULT) NIL (FFI:PARSE-C-TYPE '(FFI:C-FUNCTION (:ARGUMENTS) (:RETURN-TYPE FFI:INT) (:LANGUAGE :STDC)))))) as i say it works on OSX. But I might also be having problems with the portmidi.dll itself. --rick |
From: Sam S. <sd...@gn...> - 2005-11-27 00:52:29
|
> * Rick Taube <gnhor@hvhp.rqh> [2005-11-26 18:05:17 -0600]: > > (FUNCALL > (LOAD-TIME-VALUE > (FFI::FOREIGN-LIBRARY-FUNCTION "Pm_Initialize" (FFI::FOREIGN-LIBRARY > :DEFAULT) NIL > (FFI:PARSE-C-TYPE > '(FFI:C-FUNCTION (:ARGUMENTS) (:RETURN-TYPE FFI:INT) (:LANGUAGE > :STDC)))))) > > as i say it works on OSX. But I might also be having problems with the > portmidi.dll itself. I would expect to see "portmidi.dll" instead of :default I think you should try to talk to the cffi people -- Sam Steingold (http://www.podval.org/~sds) running w2k http://www.openvotingconsortium.org/ http://www.camera.org http://pmw.org.il/ http://truepeace.org http://www.iris.org.il http://www.dhimmi.com/ You think Oedipus had a problem -- Adam was Eve's mother. |
From: Rick T. <ta...@ui...> - 2005-11-27 15:26:48
|
> I would expect to see "portmidi.dll" instead of :default > I think you should try to talk to the cffi people ok thanks, ill do that. best, Rick |
From: O. <lu...@gm...> - 2005-11-27 17:51:54
|
Hello, Sam Steingold <sd...@gn...> writes: >> (FUNCALL >> (LOAD-TIME-VALUE >> (FFI::FOREIGN-LIBRARY-FUNCTION "Pm_Initialize" (FFI::FOREIGN-LIBRARY >> :DEFAULT) NIL >> (FFI:PARSE-C-TYPE >> '(FFI:C-FUNCTION (:ARGUMENTS) (:RETURN-TYPE FFI:INT) (:LANGUAGE >> :STDC)))))) >> >> as i say it works on OSX. But I might also be having problems with the >> portmidi.dll itself. > > I would expect to see "portmidi.dll" instead of :default > I think you should try to talk to the cffi people We use :default there because the library name is not passed to CFFI:DEFCFUN, in a similar way to pretty much every other FFI. I suppose this will have to change if we want to support CLISP's non-dynamic FFI. Rick, can you send a testcase to CFFI mailing list perhaps along with the results of running CFFI's testsuite? -- Luís Oliveira luismbo (@) gmail (.) com Equipa Portuguesa do Translation Project http://www.iro.umontreal.ca/translation/registry.cgi?team=pt |
From: Sam S. <sd...@gn...> - 2005-11-27 18:09:32
|
> * Lu=C3=ADs Oliveira <yhvfzob@tznvy.pbz> [2005-11-27 17:41:42 +0000]: > > Sam Steingold <sd...@gn...> writes: >>> (FUNCALL >>> (LOAD-TIME-VALUE >>> (FFI::FOREIGN-LIBRARY-FUNCTION "Pm_Initialize" (FFI::FOREIGN-LIBRARY >>> :DEFAULT) NIL >>> (FFI:PARSE-C-TYPE >>> '(FFI:C-FUNCTION (:ARGUMENTS) (:RETURN-TYPE FFI:INT) (:LANGUAGE >>> :STDC)))))) >>> >>> as i say it works on OSX. But I might also be having problems with the >>> portmidi.dll itself. >> >> I would expect to see "portmidi.dll" instead of :default >> I think you should try to talk to the cffi people > > We use :default there because the library name is not passed to > CFFI:DEFCFUN, in a similar way to pretty much every other FFI. I > suppose this will have to change if we want to support CLISP's > non-dynamic FFI. if by "non-dynamic FFI" you mean clisp-link, then :default is not the way. if I understand correctly how dlsym() works, it is enough to open the library once with (ffi::foreign-library "portmidi.dll") and then you can find symbols there with (:library :default) which means dlsym("foo",RTLD_DEFAULT). --=20 Sam Steingold (http://www.podval.org/~sds) running w2k http://www.mideasttruth.com/ http://www.camera.org http://www.dhimmi.com/ http://www.palestinefacts.org/ Marriage is the sole cause of divorce. |
From: Rick T. <ta...@ui...> - 2005-11-27 20:00:42
|
> > Rick, can you send a testcase to CFFI mailing list perhaps along with > the results of running CFFI's testsuite? yes of course, ill get another crack at that windows machine later today or tomorrow. but im thinking that this may be due -- in whole or in part -- to a problem with the .dll itself because i couldnt load it into lispworks personal either. (the portmidi.dll was sent to me by someone with a c compiler on xp...) i also have a CFFI interface to MidiShare that works in clisp on osx, ill download the xp midshare distribution and try that too... |