Thanks fellas; that seems to have gotten me somewhere.<div><br></div><div>I was able to open the shared lib and the interface file to initialize the interpreter:</div><div><div><div>CL-USER&gt; (open-shared-library &quot;/usr/lib/<a href="http://libpython2.5.so">libpython2.5.so</a>&quot;)</div>
<div>#&lt;SHLIB libpython2.5.so.1.0 #x30004138361D&gt;</div><div>CL-USER&gt; (use-interface-dir :python25)</div><div>#&lt;INTERFACE-DIR :PYTHON25 #P&quot;python25/&quot; #x3000414D738D&gt;</div><div>CL-USER&gt; (#_Py_Initialize)</div>
</div><div>NIL</div><div><br></div><div>Next, I try to call a function that cakes a simple char array but am getting an error:</div></div><div> (with-cstrs ((simple &quot;print &#39;hello&#39;&quot;)) (#_PyRun_SimpleString simple))</div>
<div>errors with:</div><div>Foreign function not found: X86-LINUX64::|PyRun_SimpleString|</div><div><br></div><div><br></div><div>I can find the symbol (or whatever) via  (external &quot;PyRun_SimpleString&quot;), so what am I doing wrong?</div>
<div><br></div><div>thanks again,</div><div>Mike</div><div><br></div><div><br></div><div><div class="gmail_quote">On Fri, Aug 7, 2009 at 1:33 PM, Gary Byers <span dir="ltr">&lt;<a href="mailto:gb@clozure.com">gb@clozure.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
The #_ reader macro expects to read a case-sensitive foreign function name,<br>
as in:<br>
<br>
(#_Py_Initialize [whatever args it takes if any])<br>
<br>
At some point, #_ winds up interning a mixed-case symbol in the OS<br>
package and defining that symbol as a macro that expands into some<br>
sort of foreign-function call.  Those symbols might show up in error<br>
messages or backtraces, but you don&#39;t generally deal with them directly.<br>
<br>
Foreign types (and field accessors) are represented as keywords with<br>
upper-case substrings surrounded by angle brackets.  The canonical<br>
rectangle type used in Cocoa is called &quot;NSRect&quot; in ObjC, which is<br>
represented as :&lt;NSR&gt;ect in CCL&#39;s FFI.  That can get pretty difficult<br>
to type (and to read); the #&gt; reader macro reads a case-sensitive string<br>
and returns a keyword with angle brackets in the right places:<br>
<br>
? #&gt;NSRect<br>
:&lt;NSR&gt;ect<br>
<br>
which is at least slightly better than having to type the angle brackets<br>
yourself.<br>
<br>
If you mix the two (#_ and #&gt;), you get the behavior that you got: the<br>
FFI can&#39;t find a foreign function named by a keyword that contains angle<br>
brackets in its name.  (I suppose that we -could- try to interpret that<br>
as a foreign function name and install a macro on the keyword, but we don&#39;t.)<div><div></div><div class="h5"><br>
<br>
<br>
<br>
On Fri, 7 Aug 2009, Michael Kohout wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi all-<br>
Inspired by a previous post, I&#39;m trying to import python2.5 using ccl&#39;s ffi,<br>
but I&#39;m having troubles.<br>
<br>
I&#39;ve built and run ffigen, written my populate.sh script, called it from<br>
within ccl with (ccl:create-interfaces :python25), and referenced those<br>
interfaces with  (use-interface-dir :python25).<br>
<br>
After which I try to call a function defined by python&#39;s c api:  (#_<br>
#&gt;Py_Initialize)<br>
<br>
However, when I try to call a function defined in python&#39;s c lib, I get an<br>
error:<br>
Foreign function not found: :&lt;P&gt;Y_&lt;I&gt;NITIALIZE<br>
<br>
<br>
Any suggestions?  Am I missing any steps?<br>
thanks<br>
Mike Kohout<br>
<br>
<br>
<br>
</blockquote>
</div></div></blockquote></div><br></div>