txt: ## nativecast.md
  nativecast
  
  Combined from primary sources listed below.
  
  # [In Native calling interface](#___top "go to top of document")[§](#(Native_calling_interface)_sub_nativecast "direct link")
  
  See primary documentation
  [in context](/language/nativecall#sub_nativecast)
  for **sub nativecast**.
  
  ```raku
  sub nativecast($target-type, $source) is export(:DEFAULT)
  ```
  
  This will *cast* the `Pointer` `$source` to an object of `$target-type`. The source pointer will typically have been obtained from a call to a native subroutine that returns a pointer or as a member of a `struct`, this may be specified as `void *` in the `C` library definition for instance, but you may also cast from a pointer to a less specific type to a more specific one.
  
  As a special case, if a [`Signature`](/type/Signature) is supplied as `$target-type` then a `subroutine` will be returned which will call the native function pointed to by `$source` in the same way as a subroutine declared with the `native` trait. This is described in [Function Pointers](/language/nativecall#Function_pointers).
  