From: Pieter Breed
Subject: ffi, clisp and dll's
Date: 
Message-ID: <c21kvq$5rv$1@ctb-nnrp2.saix.net>
Hi

I am working on windows xp with clisp.

I just wrote a little dll with visual studio and I managed to do a 
(ffi:def-call-out) on it. It loaded it right, executed the function 
which I specified and I am extremely happy about it :)

My question: Is there a way to release this dll from within clisp or 
lisp code? I recompiled the .dll and tried to copy it to the working 
lisp directory, but couldn't because of the fact that the old .dll was 
still in use.

Friendly Regards
Pieter Breed

From: Kenny Tilton
Subject: Re: ffi, clisp and dll's
Date: 
Message-ID: <W%11c.2934$Wo2.149@twister.nyc.rr.com>
Pieter Breed wrote:
> Hi
> 
> I am working on windows xp with clisp.
> 
> I just wrote a little dll with visual studio and I managed to do a 
> (ffi:def-call-out) on it. It loaded it right, executed the function 
> which I specified and I am extremely happy about it :)
> 
> My question: Is there a way to release this dll from within clisp or 
> lisp code? I recompiled the .dll and tried to copy it to the working 
> lisp directory, but couldn't because of the fact that the old .dll was 
> still in use.

FWIW, look for something like what I use on AllegroCL: unload-library. I 
do not use CLisp much, so I do not know if it has something like that. I 
exited ACL and came back in before thinking to look for an unload function.

kenny

-- 
http://tilton-technology.com

Why Lisp? http://alu.cliki.net/RtL%20Highlight%20Film

Your Project Here! http://alu.cliki.net/Industry%20Application
From: Joerg Hoehle
Subject: Re: ffi, clisp and dll's
Date: 
Message-ID: <ur7vz72vj.fsf@users.sourceforge.net>
Pieter Breed <·······@lynxgeo.com> writes:
> I am working on windows xp with clisp.
> 
> I just wrote a little dll with visual studio and I managed to do a 
> (ffi:def-call-out) on it. It loaded it right, executed the function 
> which I specified and I am extremely happy about it :)
> 
> My question: Is there a way to release this dll from within clisp or 
> lisp code? I recompiled the .dll and tried to copy it to the working 
> lisp directory, but couldn't because of the fact that the old .dll was 
> still in use.

CLISP doesn't come with a function to unlink a foreign library.
Yet I believe you could come up with code which achieves this goal if you can
1. find the MS-windows dll which contains the CloseLibrary (name?) call
2. invoke that with your #<foreign-pointer> to your .dll
3. invoke (setf (validp #<foreign-pointer to your library>) nil)

Basically, it's doing the job of unlinking the library by hand, using the FFI itself.

Next time FFI::FOREIGN-LIBRARY will be called (e.g. via
FFI:DEF-CALL-OUT), IIRC, CLISP should open the library again because
it sees the defunct pointer.

[the CLISP mailing list might be a better place for clisp specific
questions. I came across your posting here merely by chance.]

Regards,
	Jorg Hohle
Telekom/T-Systems Technology Center
From: sds
Subject: Re: ffi, clisp and dll's
Date: 
Message-ID: <1107278704.057173.48710@f14g2000cwb.googlegroups.com>
Pieter Breed wrote:
> I am working on windows xp with clisp.
>
> I just wrote a little dll with visual studio and I managed to do a
> (ffi:def-call-out) on it. It loaded it right, executed the function
> which I specified and I am extremely happy about it :)
good!

> My question: Is there a way to release this dll from within clisp or
> lisp code? I recompiled the .dll and tried to copy it to the working
> lisp directory, but couldn't because of the fact that the old .dll
was
> still in use.

clisp CVS head now has FFI:CLOSE-FOREIGN-LIBRARY
which should do what you need.