| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
| |
The type compiler specifies cptr as the Lisp type for various
ptr types and the buf type. This will be misleading with the
increasing role of cptr.
* ffi.c (ffi_get_lisp_type): New static function.
(ffi_type_compile): Use buf as the Lisp type for the buf
and buf-d FFI types. For ptr and its variants, use the
target type's Lisp type as the pointer's Lisp type.
For instance (ptr int) has integer as its Lisp type.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
CPTR shares representation and a lot of implementation with
COBJ. The COBJ class symbol is the CPTR type tag. There is no
hierarchy among CPTR tags. The nil tag is used for a modicum
of type looseness, so that we don't straitjacket ourselves
too much into this tag-based typing scheme.
All existing cptr objects are becoming CPTR, and all
get a nil tag, except for dlopen library handles, and
dlsym symbols, which are tagged as dlhandle and dlsym.
The FFI framework will support tag-declared cptr's. This will
help with safety. For instance, suppose an API has half a
dozen different kinds of opaque handles. If they are all just
cptr on the TXR Lisp side, it's easy to mix them up, passing
the wrong one to the wrong C function.
* lib.h (enum type): New enum member, CPTR.
(cptr_print_op, cptr_typed, cptrp, cptr_type, cptr_handle):
Declared.
(cptr_addr_of): Parameters added.
* lib.c (code2type): Map CPTR type code to cptr_s.
(equal): Handle CPTR objects. They are only equal to other
CPTR objects which have the same operations, and
are equal under the equal function of those operations.
(cptr_print_op): New function.
(cptr_ops): Use cptr_print_op rather than cobj_print_op.
(cptr_typed): New function.
(cptr): Use cptr_typed to make a cptr with tag nil,
rather than using cobj.
(cptrp, cptr_handle, cptr_type): New functions.
(cptr_get): Go through cptr_handle rather than cobj_handle.
(cptr_addr_of, cptr_zap, cptr_free): Use call to cptr_handle
rather than cobj_handle for the type checking side effect.
New parameters for type and parent function name.
(obj_print_impl): Handle CPTR with same case as COBJ.
* gc.c (finalize, mark_obj): Handle CPTR cases using
common code with COBJ.
* hash.c (equal_hash): Handle CPTR just like COBJ.
* eval.c (eval_init): Register cptrp and cptr-type intrinsic
functions.
* ffi.c (ffi_cptr_put, ffi_cptr_get, ffi_cptr_alloc): Use the
potentially type-safe cptr_handle, instead of cptr_get.
However, for an untagged cptr, there is no type safety because
tft->mtypes is nil. The argument can be any kind of cptr.
* sysif.c (dlhandle_s, dlsym_s): New symbol variables.
(cptr_dl_ops): Use cptr_print_op.
(dlopen_wrap, dlclose_wrap): Use typed cptr with
dlhandle as the type.
(dlsym_wrap, dlsym_checked, dlvsym_wrap, dlvsym_checked):
Recognize only a cptr of type dlhandle for the library.
Construct a typed cptr of type dlsym.
(sysif_init): Initialize dlhandle_s and dlsym_s.
Register dlsym function using dlsym_s.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Renaming cobj_hash_op to cobj_eq_hash_op. This function is
only appropriate to use with COBJ objects which use
eq as their equal funtion. I've spotted one instance of an
inappropriate use which have to be addressed by a different
commit: the equal function is other than eq, but cobj_hash_op
is used for the equal hash.
* lib.h (cobj_hash_op): Declaration renamed to
cobj_eq_hash_op.
* hash.c (cobj_hash_op): Renamed to cobj_eq_hash_op.
(hash_iter_ops): Refer to renamed cobj_hash_eq_op.
* ffi.c (ffi_type_builtin_ops, ffi_type_struct_ops,
ffi_type_ptr_ops, ffi-closure_ops, ffi_call_desc_ops):
Likewise.
* lib.c (cptr_ops): Likewise.
* parser.c (parser_ops): Likewise.
* rand.c (random_state_ops): Likewise.
* regex.c (char_set_ops, regex_obj_ops): Likewise.
* socket.c (dgram_strm_ops): Likewise.
* stream.c (null_ops, stdio_ops, tail_ops, pipe_ops, dir_ops,
string_in_ops, byte_in_ops, strlist_in_ops, string_out_ops,
strlist_out_ops, cat_stream_ops, record_adapter_ops):
Likewise.
* struct.c (struct_type_ops): Likewise.
* sysif.c (cptr_dl_ops): Likewise.
* syslog.c (syslog_strm_ops): Likewise.
* unwind.c (cont_ops): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (ffi_varray_alloc, ffi_char_array_put): Use cnum type
consistently to avoid signed/unsigned comparison warning from g++.
(ffi_closure_dispatch_safe): Put block of code into a braced
statement so that the macro-generated switch case branch isn't
crossing the initialization of a variable. Also, convert
cast added where we are passing a void * to a mem_* parameter.
* utf8.c (utf8_dup_from): Fix coerce macros being used to strip
qualifiers, not only convert type.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When taking ownership of any pointer from FFI space, null it
out. This is safer in general and prevents corruption
problems in the callback interface when an exception is
thrown. For instance (ptr wstr-d) callback argument:
callback takes ownership of the pointer in a string object;
throws an exception. The FFI call dispatch runs the in
semantics to get the string value out; but the old pointer
is still there which may not be used.
* ffi.c (ffi_str_d_get, ffi_wstr_d_get, ffi_bstr_d_get,
ffi_buf_d_in, ffi_buf_d_get, ffi_ptr_d_get): Overwrite
the source location of a freed or owned pointer with
null.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The direct pointer use of the wstr type causes problems
for callbacks. Plus allowing the foreign world to retain
the pointers into string objects is inherenty unsafe.
We can introduce an "unsafe wstr" type in a later release
for efficiency.
* ffi.c (ffi_wstr_in): New function.
(ffi_wstr_put): Removed by ffi_wstr_d_put rename.
(ffi_wstr_d_put): Renamed to ffi_wstr_put: both wstr and
wstr-d strings have a dynamically-allocating put.
(ffi_init_types): Give wstr type ffi_wstr_in handler.
wstr-d type's registration switched to ffi_wstr_put,
which is just ffi_wstr_d_put renamed.
* txr.1: Memory management notes for wstr updated.
|
|
|
|
|
|
|
|
| |
* configure: detect clockid_t and loff_t, providing
HAVE_CLOCKID_T and HAVE_LOFF_T config macros.
* ffi.c (ffi_init_extra_types): Register clockid-t
and loff-t types only if available.
|
|
|
|
| |
* buf.c, ffi.c: Must include <stdarg.h> for va_list.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (stuct txr_ffi_closure): New member, abort_retval.
(ffi_closure_mark_op): Mark the new member.
(ffi_closure_dispatch_safe): Implement the abort_retval.
If it is not nil, use put to place the value into the
return buffer. There is a risk that this could also throw
an exception, which is no longer protected: programer's
problem.
(ffi_make_closure): New abort_ret_in argument, which is
defaulted and stored.
(ffi_init): Update registration of ffi-make-closure to
reflect new argument.
* ffi.h (ffi_make_closure): Declaration updated.
* share/txr/stdlib/ffi.tl (sys:deffi-cb-expander):
Add abort-retval parameter; insert into ffi-make-closure
call.
(deffi-cb): Take optional abort-retval expression;
pass it down to the expander function.
(deffi-cb-unsafe): Pass nil as abort-retval down to expander.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We don't want, by default, for callbacks to capture delimited
continuations across foreign code, or perpetrate non-local
transfers across foreign code. Here, we take an approach
similar for what was done in ftw_wrap.
* ffi.c (s_exit_point): New global variable with internal
linkage.
(ffi_call_wrap): If s_exit_point isn't nil, then it means that
the callback intercepted a nonlocal transfer and stored its
exit point. We resume the transfer to that exit point instead
of returning normally.
(ffi_closure_dispatch_safe): New static function.
(ffi_make_closure): Support a new argument which indicates
whether to make a closure which uses
ffi_closure_dispatch_safe, or ffi_closure_dispatch.
(ffi_init): Update registration of ffi-make-closure intrinsic.
* ffi.h (ffi_make_closure): Declaration updated.
* share/txr/stdlib/ffi.tl (sys:deffi-cb-expander): New
function.
(deffi-cb): Macro internals replaced by call to new
function.
(deffi-cb-safe): New macro.
* txr.1: Documentation of ffi-make-closure updated.
New deffi-cb-unsafe macro documented.
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the object being encoded is a string, and the array element
type is char, wchar or bchar, then encode a string, honoring
null termination flag. Unused space in the destination array
is filled with zeros.
* ffi.c (ffi_char_array_put, ffi_wchar_array_put,
ffi_bchar_array_put): New functions.
(ffi_array_put, ffi_array_out): Use new functions under
the right conditions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (struct txr_ffi_type): is_varray flag removed.
We no longer need to test this and adjust behavior.
(ffi_array_in, ffi_array_out): Don't calculate nelem
differently based on flag; just pass down tft->nelem. Code
cleaned up.
(ffi_varray_put, ffi_varray_in): New functions.
(ffi_type_compile): Use ffi_varray_put and ffi_varray_in for
variable array type instead of setting flag. Also, specify the
out function as null; it never made sense to have one, since
there is no get. Finally, set the size of the type to zero,
since it has no pass by value semantics.
|
|
|
|
|
|
| |
* ffi.c (ffi_varray_alloc): We must use the element type's
size, not the array's size. Also, cosmetic issue in error
message fixed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This anticipates a redesign of variable arrays. Variable
arrays will have their own put, in, get and out functions,
which will share some implementation.
* ffi.c (ffi_array_in_common): New function.
(ffi_array_in): Bulk of code replaced by call to
ffi_array_in_common.
(ffi_array_put_common, ffi_array_out_common,
ffi_array_get_common): New functions.
(ffi_array_put, ffi_array_out, ffi_array_get): Reduced to thin
wrappers.
|
|
|
|
|
|
| |
* ffi.c (ffi_make_call_desc): Throw if any argument
type is something with zero size. Throw if the return
type has zero size and isn't the type void.
|
|
|
|
|
|
|
| |
* ffi.c (ffi_char_array_get, ffi_wchar_array_get,
ffi_bchar_array_get): New static functions.
(ffi_array_in, ffi_array_get): Replace common code
with calls to code moved out into functons.
|
|
|
|
|
|
|
|
|
| |
Arrays can be varray, whose size is just pointer size.
The string extraction operations shouldn't be referring
to the size.
* ffi.c (ffi_array_in, ffi_array_et): Use nelem instead
of tft->size.
|
|
|
|
|
|
|
|
|
|
|
|
| |
What this allows is for situations when a foreign function
returns the pointer that it has been passed. If that pointer
is temporary storage allocated by FFI, then it is no longer
valid after performing the in pass on the args. Therefore, we
should decode the return value first, while the returned
pointer is valid.
* ffi.c (ffi_call_wrap): Move the return value get before
the argument post-processing in pass.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We want to be able to extract null-terminated UTF-8 strings
from arrays, without trailing junk, yet retain the ability to
extract the entire array including embedded nulls. The natural
way is to use the array/zarray distinction.
* ffi.c (ffi_array_in, ffi_array_get): Don't try to guess
whether the array is null terminated; just rely on the
null_term flag, and treat accordingly.
* txr.1: Doc updated.
|
|
|
|
|
| |
* ffi.c (cptr_make): Function removed.
(ffi_init): Registration of cptr and cptr-null removed.
|
|
|
|
|
|
|
|
|
| |
* ffi.c (ffi_float_put, ffi_double_put): Support a useful
type looseness by allowing integers and character Lisp
values to pair with FFI floating-point types, imitating
the conversion which happens in C function calls.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (ffi_i8_put, ffi_u8_put, ffi_i16_put, ffi_i16_get,
ffi_u16_put, ffi_u16_get, ffi_i32_put, ffi_i32_get,
ffi_u32_put, ffi_u32_get, ffi_i64_put, ffi_i64_get,
ffi_u64_put, ffi_u64_get, ffi_char_put, ffi_char_get,
ffi_uchar_get, ffi_short_get, ffi_ushort_put, ffi_ushort_get,
ffi_int_put, ffi_int_get, ffi_uint_put, ffi_uint_get,
ffi_long_put, ffi_long_get, ffi_ulong_put, ffi_ulong_get,
ffi_float_put, ffi_float_get, ffi_double_put, ffi_double_get,
ffi_wchar_put, ffi_wchar_get, ffi_cptr_put, ffi_cptr_get):
memcpy operations replaced by by assignments through pointer
casts.
|
|
|
|
|
|
| |
* ffi.c (ffi_closure_print_op): Add information to the
printed representation: the Lisp function, and call desc.
Eliminate spurious # character before closing angle bracket.
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (ffi_struct_put, ffi_struct_out): Just skip the space
corresponding to the anonymous padding member; don't memset
with zeros. Doing this is inconsistent because we are not
zero-filling the ordinary alignment padding between members
and at the end of the struct. If the uninitialized garbage
is a problem in some uses, we can provide a variation of
the struct type which is zero initialized.
|
|
|
|
|
|
|
| |
* ffi.c (ffi_array_put, ffi_array_out): If dealign with
a variable array that is null terminated, let's add one to
nelem, so that all elements of the Lisp sequence are
converted, and then a null.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Backing out of the scheme of (ptr buf) passing the
address of the internal pointer within buf objects.
Also giving buf in handlers, to prevent the fallback
on get.
* buf.c (buf_addr_of): Function removed.
* buf.h (buf_addr_of): Declaration removed.
* ffi.c (ffi_buf_in, ffi_buf_d_in): New functions.
(ffi_buf_alloc): Function removed.
(ffi_type_compile, ffi_init_types): Remove specialty alloc and
free functions from buffers, so the regular fixed allocator is
used. Give buffers the new in functions.
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (ffi_ptr_in_in): Don't just free the buffer for
the pointer itself, but call the in handler of the target
type if it has one. Pass a false copy flag to it, so that
that a ptr-in pass semantically resembles a by-value pass.
(ffi_ptr_in_d_in): New static function.
(ffi_type_compile): Give ptr-in-d type the ffi_ptr_in_d_in
function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (ffi_ptr_out_in, ffi_ptr_out_s_in): If the target type
has no in handler, fall back on its get. Here, it is without
regard for the copy flag, because a zero value of that flag
just indicates that the ptr-out itself is passed by-value.
The target object is never by value
(ffi_in): Add copy flag parameter, so the full interface
is exposed, like in ffi_out. Fall back on get, if there is
no in and the copy flag is true. Just return the original
object if the type has no in, and copy is false.
(ffi_init): Registration of ffi-in adjusted to four
parameters.
* ffi.h (ffi_in): Declaration updated.
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (ffi_struct_in, ffi_array_in): Only fall back on get
if the copy flag is true. If the copy flag is false, we must
not extract. That's not ony as an optimization (no point in
extracting back from by-value objects). We also avoid
extracting from pointers we don't own, like in the case
of str-d, where the pointer is owned by the foreign function
and may have been freed.
|
|
|
|
|
|
|
| |
* ffi.c (ffi_struct_out, ffi_array_out): For any element
which has no out function, do a put if the copy flag is
true. Otherwise callbacks cannot update members in
aggregates passed by pointer.
|
|
|
|
|
|
| |
* ffi.c (ffi_bstr_in): New function.
(ffi_init_types): Give bstr type ffi_bstr_in as the in
function.
|
|
|
|
|
|
|
|
|
| |
* ffi.c (ffi_closure_dispatch): Only call out on those
arguments which have a non-null out pointer, otherwise we will
crash. Those non-null values are the reason we even execute
that loop at all.
(ffi_out): Do a put for basic types (which have no out
handler).
|
|
|
|
|
|
|
|
|
|
| |
Omission of the dimension will be expressed by actual omission
rather than the void placeholder. It's just a harmless bit of
parsing providing a reasonably intuitive syntax that doesn't
leave readers wondering what void is doing there.
* ffi.c (ffi_type_compile): Rearrange array parsing code.
Also diagnose if the form has more than thre elements.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This solves the second issue described in parent
commit. When a str type is passed in-out using
(ptr str) in a struct or array, the struct or array
is not picking up the new string. The pointer is
freed, but the old object persists.
* ffi.c (ffi_str_in): Function renamed to ffi_str_in. If the
copy flag is true, retrieves a string from the pointer and
that string is returned instead of the incoming one, mapping a
null pointer to nil. Either way, the pointer is freed. Since
ffi_ptr_out_in passes 1 for the copy flag, that ensures we
extract the new string and plant it into the array.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We have two problems. Firstly, the in handler is being
called on by-value struct and array arguments, and is
wastefully updating the members in the Lisp object.
The second issue is opposite the str type fails to retrieve
the updated string because ffi_freeing_in just frees.
We don't address this issue here, but the groundwork
is laid to fix it in the next commit.
* ffi.c (struct txr_ffi_type *): Add a copy flag argument
to the in virtual function.
(ffi_freeing_in, ffi_ptr_in_in, ffi_ptr_out_in,
(ffi_ptr_out_in, ffi_ptr_out_s_in): Take new copy argument.
Don't pass it down to the recursive in; pass 1.
(ffi_struct_in, ffi_array_in): Take copy argument and pass it
down.
(make_ffi_type_pointer): Type of in parameter updated.
(ffi_call_wrap): Pass 0 to top level in functions.
(ffi_in): Pass to in, so new object is returned.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If an array dimension is void, it is a varray. The C
representation is pointer. The size is inferred
from the length of the object. Doesn't support get
method.
* ffi.c (struct txr_ffi_type): New bitfield flag, is_varray.
(ffi_varray_alloc): New function.
(ffi_array_in, ffi_array_put, ffi_array_out): Check is_varray
flag and use dynamic array size from object.
(ffi_type_compile): If the array dimension is the symbol
void, create a varray: a mongrel created using
make_ffi_type_pointer, but using the array functions,
plus alloc and free handlers, and the is_varray flag
being set.
|
|
|
|
|
|
|
|
| |
* ffi.c (make_ffi_type_pointer): The underlying ffi type
is always ffi_type_pointer, so the parameter for specifying
it is removed, and it is hard-coded.
(ffi_type_compile): Remove &ffi_type_pointer argument from
a half dozen calls.
|
|
|
|
|
|
|
|
|
| |
This will support a sizeof macro.
* ffi.c (ffi_size): New function.
(ffi_init): Register ffi-size intrinsic.
* ffi.h (ffi_size): Declared.
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (ffi_put_into, ffi_put, ffi_in, ffi_get, ffi_out):
New functions.
(ffi_init): ffi-put-into, ffi-put, ffi-in, ffi-get, ffi-out:
intrinsics registered.
* ffi.h (ffi_put_into, ffi_put, ffi_in, ffi_get, ffi_out):
Declared.
|
|
|
|
|
| |
* ffi.c (ffi_type_compile): Check for a negative buffer
size and throw.
|
|
|
|
|
|
| |
* ffi.c (ffi_type_compile): Throw error if the dimension
is negative in any array operator, or also if it is zero in a
zarray operator.
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (struct txr_ffi_type): New bitfield flag, bchar_conv.
(ffi_array_in, ffi_array_get): Handle bchar_conv.
(ffi_type_compile): Set bchar_conv flag for array of bchar.
* lib.c (string_8bit_size): New function.
* lib.h (string_8bit_size): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A zarray of length N is requiring the Lisp vector to be
of length N.
* ffi.c (ffi_array_put): Reorder logic in the loop so that
when we are putting out the terminating null element of a
zarray, we do not access the corresponding element of the Lisp
vector. Thus if the zarray is N elements wide, the Lisp
vector need only be at least N-1 elements wide, not N.
(ffi_array_in): Copy the null element of a zarray to the
vector only if the vector object at least N elements.
If the vector is nil so that we have to construct one,
construct a vector of N-1 for a zarray.
(ffi_array_get): For a zarray, construct a vector of N-1
elements. Do not even fetch the null.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The bstr type is like str, but doesn't perform UTF-8
conversion. The C data is assumed to be null terminated byte
strings representing code points U+0000 through U+00FF.
* ffi.c (bstr_s, bstr_d_s): New symbol variables.
(ffi_bstr_put, ffi_bstr_get, ffi_bstr_d_get): New static
functions.
(ffi_init_types): Register bstr and bstr-d types.
(ffi_init): Initialize bstr_s and bstr_d_s.
* ffi.h (bstr_s, bstr_d_s): Declared.
* lib.c (chk_strdup_8bit, string_8bit): New function.
* lib.h (chk_strdup_8bit, string_8bit): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
| |
bchar is like uchar, except that in the decode direction,
it produces character objects rather than integers.
* ffi.c (bchar_s): New symbol variable.
(ffi_bchar_get): New static function.
(ffi_init_types): Register bchar type.
(ffi_init): Initialize bchar_s.
* ffi.h (bchar_s): Declared.
|
|
|
|
|
|
| |
* ffi.c (ffi_str_d_put): Function removed. It is identical to
ffi_str_put.
(ffi_init_types): Use ffi_str_put for the str-d type.
|
|
|
|
|
|
| |
* ffi.c (ffi_char_get): Get a char object as a Lisp character,
rather than number. Users who want a byte to convert to a
an integer can use one of the types int8 or uint8 instead.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
One more ptr type is useful. This type is for objects returned via
pointers embedded in arrays or structures, whereby the callee
establishes both the pointer and the data.
This is similar to ptr-out-d; the difference is that the
data has an indefinite lifetime ("s" denotes "static")
and so the pointer is not freed after the call takes place
and the data is extracted into Lisp objects.
* ffi.c (ptr_out_s_s): New symbol variable.
(ffi_ptr_out_s_in): New function.
(ffi_type_compile): Handle new ptr_out_s_s.
(ffi_init): Initialize ptr_out_s.
* ffi.h (ptr_out_s_s): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since the callee allocates the buffer for a ptr-out-d, the FFI
mechanism should not also be allocating a buffer to receive
the object. The buffer pointer will just be overwritten by the
callee with its own dynamic pointer. We should pass a null
pointer which the callee fills in (making a ptr-out-d not
suitable as a by-value parameter).
Initially, ptr-out-d was envisioned for return values only
and for use in callbacks, which is why I neglected this
aspect.
* ffi.c (ffi_ptr_out_null_put): New static function.
(ffi_type_compile): Use ffi_ptr_out_null_put for the
ffi_ptr_out_d case, so caller places a null pointer, then
frees the pointer that the callee places there.
|
|
|
|
|
|
| |
* ffi.c (ffi_ptr_put): Rnamed to ffi_ptr_in_put.
(ffi_type_compile): All uses of ffi_ptr_put replaced with
ffi_ptr_in_put.
|