@Documented @Retention(value=RUNTIME) @Target(value={TYPE,METHOD}) public @interface Allocator
native void allocate(...)
are recognized
as allocators even without annotation. This behavior can be changed by annotating
the method with the Function
annotation. An allocator must have no
return values, but can have parameters corresponding to the ones found on the
native C++ constructors.
In a nutshell, an allocator uses the C++ new
operator along with all
the given arguments, and initializes the Pointer.address
as well as
the Pointer.deallocator
with NativeDeallocator
, based on the
delete
operator, if not additionally annotated with NoDeallocator
.
Can also be used on classes to set the max()
value for enclosed function pointers.
Pointer.init(long, long, long, long)
,
Generator
Modifier and Type | Optional Element and Description |
---|---|
int |
max
The maximum number of instances that can be allocated in the case of a
FunctionPointer subclass. |
public abstract int max
FunctionPointer
subclass.
Does not affect the underlying function object or other Pointer
which have no such allocation limits.Copyright © 2020. All rights reserved.