X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;ds=inline;f=doc%2Fref.sgml;h=607edfced873810076050e650872e0270ec179d5;hb=37829b2fa07ae5f2ce6d7e1b47251b53ef54c8c2;hp=fcb08ebf8af2ca1e2e2e45629fcfe73eee1a7eef;hpb=ca7e9a2299773cfbc927d71e6289549601438b24;p=uffi.git
diff --git a/doc/ref.sgml b/doc/ref.sgml
index fcb08eb..607edfc 100644
--- a/doc/ref.sgml
+++ b/doc/ref.sgml
@@ -877,7 +877,7 @@ can be freed.
type
- A unevaluated type of foreign object to allocate.
+ The type of foreign object to allocate. This parameter is evaluated.
@@ -908,7 +908,7 @@ array of type that is size members
Examples
(def-struct ab (a :int) (b :double))
-(allocate-foreign-object ab)
+(allocate-foreign-object 'ab)
=> #<ptr>
@@ -973,6 +973,79 @@ array of type that is size members
+
+
+ with-foreign-object
+ Wraps the allocation of a foreign object around a body of code.
+
+ Macro
+
+
+ Syntax
+
+ with-foreign-object (var type) &body body => form-return
+
+
+
+ Arguments and Values
+
+
+ var
+
+ The variable name to bind.
+
+
+
+
+ type
+
+ The type of foreign object to allocate. This parameter is evaluated.
+
+
+
+
+ form-return
+
+ The result of evaluating the body.
+
+
+
+
+
+
+ Description
+
+This function wraps the allocation, binding, and destruction of a foreign object.
+On &cmucl; and
+&lw; platforms the object is stack allocated for efficiency. Benchmarks show that &acl; performs
+much better with static allocation.
+
+
+
+ Examples
+
+(defun gethostname2 ()
+ "Returns the hostname"
+ (uffi:with-foreign-object (name '(:array :unsigned-char 256))
+ (if (zerop (c-gethostname (uffi:char-array-to-pointer name) 256))
+ (uffi:convert-from-foreign-string name)
+ (error "gethostname() failed."))))
+
+
+
+ Side Effects
+ None.
+
+
+ Affected by
+ None.
+
+
+ Exceptional Situations
+ None.
+
+
+
pointer-address
@@ -1955,6 +2028,91 @@ a session.
+
+
+ find-foreign-library
+ Finds a foreign library file.
+
+ Function
+
+
+ Syntax
+
+ find-foreign-library names directories & drive-letters types => path
+
+
+
+ Arguments and Values
+
+
+ names
+
+ A string or list of strings containing the base name of the library file.
+
+
+
+
+ directories
+
+ A string or list of strings containing the directory the library file.
+
+
+
+
+ drive-letters
+
+ A string or list of strings containing the drive letters for the library file.
+
+
+
+
+ types
+
+ A string or list of strings containing the file type of the library file. Default
+is &nil;. If &nil;, will use a default type based on the currently running implementation.
+
+
+
+
+ path
+
+ A path containing the path found, or &nil; if the library file was not found.
+
+
+
+
+
+
+ Description
+ Finds a foreign library by searching through a number of possible locations. Returns
+the path of the first found file.
+
+
+
+ Examples
+
+(find-foreign-library '("libmysqlclient" "libmysql")
+ '("/opt/mysql/lib/mysql/" "/usr/local/lib/" "/usr/lib/" "/mysql/lib/opt/")
+ :types '("so" "dll")
+ :drive-letters '("C" "D" "E"))
+=> #P"D:\\mysql\\lib\\opt\\libmysql.dll"
+
+
+
+ Side Effects
+ None.
+
+
+
+ Affected by
+ None.
+
+
+ Exceptional Situations
+ None.
+
+
+