<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<p>Hi,</p>
<p>I had a question about wrapping a c func with scheme, s7.<br>
</p>
<p></p>
<div><br>
I'm trying to understand how to wrap the declared function from the .h file with scheme in a .scm file (mywrapper.scm) so that it can be called from s7 and use the shared library.<br>
<br>
<div>> (load mywrapper.scm)<br>
> (myfunction)<br>
> (exit)</div>
</div>
<br>
<p></p>
<div>I have a .c file which includes a function (myfunction), and .h which declares that function.<br>
I compile the .c file using -fpic into an obj. file, then create a shared library, ex. mylib.so.<br>
<br>
I'm looking at SND files libc.scm and libgsl.scm which seem to be wrappers, but are quite complicated. I'm also looking at the S7 manual example for "Load a shared library", but there are static s7_pointer functions in the example's c code which seem to be
doing the wrapping on the c side as opposed to wrapping a c function in scheme using a .scm file.<br>
<br>
I'm wondering if there's a simpler example somplace where I can get some ideas about how to go about wrapping a c function in scheme, or if the manual vers. is the preferred way to go, i.e. create a library using s7 functions from c, and then load the library
into s7 to call the function?<br>
<br>
Regards,<br>
Jim<br>
</div>
<br>
</div>
</body>
</html>