<div dir="ltr"><div>Have a look at <a href="https://common-lisp.net/project/cffi/manual/html_node/Foreign-Structure-Types.html">https://common-lisp.net/project/cffi/manual/html_node/Foreign-Structure-Types.html</a>, in particular:</div><div><br></div><div>"By default, <a href="https://common-lisp.net/project/cffi/manual/html_node/convert_002dfrom_002dforeign.html#convert_002dfrom_002dforeign">convert-from-foreign</a> (and also <a href="https://common-lisp.net/project/cffi/manual/html_node/mem_002dref.html#mem_002dref">mem-ref</a>) will
make a plist with slot names as keys, and <a href="https://common-lisp.net/project/cffi/manual/html_node/convert_002dto_002dforeign.html#convert_002dto_002dforeign">convert-to-foreign</a> will
translate such a plist to a foreign structure."</div><div><br></div><div>By default, you'd invoke my-log like this: (my-log (list :str "Foo" :count 4)). That section should give you pointers on how to do something both more convenient and efficient, in case it matters.</div><div><br></div><div>HTH,<br></div><div>Luís<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Dec 7, 2018 at 2:12 PM paul tarvydas <<a href="mailto:paultarvydas@gmail.com">paultarvydas@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Using CFFI, do I need to specify translation methods when performing call-by-value to C?<br>
<br>
I am assuming (possibly incorrectly?) that cffi:defcstruct will create the translations for a C struct for me, then pass that struct by value to a Go foreign routine.<br>
<br>
Specifically, I am trying to call routines in Go from Lisp using a Lisp string.<br>
<br>
A Go string is a C struct { pointer-to-string , integer-length-of-string }<br>
<br>
Simple test code is in <a href="https://github.com/guitarvydas/lisp-go/blob/master/string-example/lisp-client.lisp" rel="noreferrer" target="_blank">https://github.com/guitarvydas/lisp-go/blob/master/string-example/lisp-client.lisp</a>.<br>
<br>
(see function "my-log", run "make" which should build and run the example, causing a NO-APPLICABLE-METHOD-ERROR).<br>
<br>
thanks<br>
pt<br>
<br>
<br>
</blockquote></div>