Package: cffi
Generic Function translate-name-to-foreign
Lambda Listtranslate-name-to-foreign (lisp-name package &optional varp) ArgumentsReturn ValueThe string representing the foreign function name. Details translate-name-to-foreign is used by defcfun to handle the conversion
of lisp names to foreign names. By default, it translates using
translate-underscore-separated-name. However, you can create specialized
methods on this function to make translating more closely match the foreign library's naming conventions. Specialize package on some package. This allows other packages to load libraries with different naming conventions. ExamplesCFFI> (defcfun some-xml-function ...) => "some_xml_function" CFFI> (defmethod translate-name-to-foreign ((spec symbol) (package (eql *package*)) &optional varp) (let ((name (translate-camelcase-name spec))) (if varp (subseq name 1 (1- (length name))) name))) => #<STANDARD-METHOD TRANSLATE-NAME-TO-FOREIGN (STRING (EQL #<Package "SOME-PACKAGE">))> CFFI> (defcfun some-xml-function ...) => "someXmlFunction" | See also |