[Openmcl-devel] Clozure CL Interface to GTK on Linux

R. Matthew Emerson rme at acm.org
Fri Mar 10 17:01:50 PST 2017

> On Mar 10, 2017, at 4:26 AM, Ralf Mattes <rm at seid-online.de> wrote:
> On Fri, Mar 10, 2017 at 07:53:37AM -0500, Craig Lanning wrote:
>> On Thu, 2017-03-09 at 20:37 -0800, R. Matthew Emerson wrote:
>>>> On Mar 9, 2017, at 1:56 PM, Craig Lanning <craig.t.lanning at gmail.co
>>>> m> wrote:
>>>> I'm running into trouble with the CLX backend for CLIM.
>>>> I noticed that there seems to be support in Clozure CL for GTK2 on
>>>> Linux.  How do I get access to that?  What do I need to load?
>>> I'm not sure it's fair to say that there is "support" for GTK, per
>>> se.
>>> There are a couple of example programs in ccl:examples; viz. gtk-
>>> minesweeper.lisp and gtk2-clock.lisp.
>> I found these after I sent my message yesterday.
>>> Maybe they'll be helpful, but I wouldn't be surprised if these
>>> examples have bit-rotted.
> Well, they are Gtk2, so they definitely did rot ;-)
>> I was unable to get them to work.
>> Is there any other info about how to access the GTK/GNOME GUI system?
> You could of course generate interface information for gtk3, but that's 
> a very unpleasant task, IIRC.

I seem to recall reading that gtk3 was more fussy about which thread that the event loop runs on.  It may require it to be run on the initial thread.  It seems that many UI toolkits have a requirement like this. I know that MS Windows doesn't have that requirement.  Let's hear it for Windows, at least on this particular matter, right?

It takes a little bit of fiddling to make new interfaces, true.

Here are some things about building and using the ffigen translator.

http://trac.clozure.com/ccl/wiki/ForeignFunctionInterface <http://trac.clozure.com/ccl/wiki/ForeignFunctionInterface>
http://trac.clozure.com/ccl/wiki/BuildFFIGEN <http://trac.clozure.com/ccl/wiki/BuildFFIGEN>
http://trac.clozure.com/ccl/wiki/CustomFramework <http://trac.clozure.com/ccl/wiki/CustomFramework>

Bringing the ffi translator up-to-date is an important task that needs to be done.  It will take some effort to get familiar with all the working parts, so it's probably not the first thing that a new contributor would want to tackle.  https://github.com/Clozure/ccl/issues/13 <https://github.com/Clozure/ccl/issues/13>

> BTW, is there any good documentation about the interface database (i.e.
> it's inner workings)?

There's http://ccl.clozure.com/docs/ccl.html#the-interface-database <http://ccl.clozure.com/docs/ccl.html#the-interface-database> and http://ccl.clozure.com/docs/ccl.html#the-interface-translator <http://ccl.clozure.com/docs/ccl.html#the-interface-translator> but I don't claim that that documentation is comprehensive.  The idea is really pretty simple:  process some header files into an s-expression format (this is what ffigen does).  Then, process that (via the code in ccl:library;parse-ffi.lisp) into a binary database that contains type/record/constant/function definitions.  Then, write some reader macros, e.g., #_ or #& that look stuff up in these databases and then produce suitable (external-call ...) or (foreign-symbol-address ...) or whatever.

If you evaluate forms like (quote #&sys_errlist) or (macroexpand '(#_getpid)) you will see what primitives this stuff expands into.  Note that it's sometimes useful to call the external-call macro directly:  it's somewhat nicer to use than %ff-call.  (macroexpand '(external-call "getpid" :pid_t)) will show you that it expands into the exact same thing you get by calling (#_getpid).

> Cheers, Ralf Mattes
>> Craig
>> _______________________________________________
>> Openmcl-devel mailing list
>> Openmcl-devel at clozure.com
>> https://lists.clozure.com/mailman/listinfo/openmcl-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20170310/e4acda7c/attachment.htm>

More information about the Openmcl-devel mailing list