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> (open-shared-library "/usr/lib/<a href="http://libpython2.5.so">libpython2.5.so</a>")</div>
<div>#<SHLIB libpython2.5.so.1.0 #x30004138361D></div><div>CL-USER> (use-interface-dir :python25)</div><div>#<INTERFACE-DIR :PYTHON25 #P"python25/" #x3000414D738D></div><div>CL-USER> (#_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 "print 'hello'")) (#_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 "PyRun_SimpleString"), 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"><<a href="mailto:gb@clozure.com">gb@clozure.com</a>></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'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 "NSRect" in ObjC, which is<br>
represented as :<NSR>ect in CCL's FFI.  That can get pretty difficult<br>
to type (and to read); the #> reader macro reads a case-sensitive string<br>
and returns a keyword with angle brackets in the right places:<br>
<br>
? #>NSRect<br>
:<NSR>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 #>), you get the behavior that you got: the<br>
FFI can'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'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'm trying to import python2.5 using ccl's ffi,<br>
but I'm having troubles.<br>
<br>
I'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's c api:  (#_<br>
#>Py_Initialize)<br>
<br>
However, when I try to call a function defined in python's c lib, I get an<br>
error:<br>
Foreign function not found: :<P>Y_<I>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>