handle_create Function

public function handle_create() result(c_handle)

Allocate a new ocean handle and return its opaque C pointer. Caller (rdb_ocean_create_from_string) is responsible for eventually passing it to handle_destroy — including on every early-return failure path, so a handle that never reached is_initialised does not leak.

Arguments

None

Return Value type(c_ptr)


Called by

proc~~handle_create~~CalledByGraph proc~handle_create handle_create proc~build_pending_handle build_pending_handle proc~build_pending_handle->proc~handle_create proc~rdb_ocean_create_from_string rdb_ocean_create_from_string proc~rdb_ocean_create_from_string->proc~build_pending_handle proc~rdb_ocean_create_pending rdb_ocean_create_pending proc~rdb_ocean_create_pending->proc~build_pending_handle

Variables

Type Visibility Attributes Name Initial
type(ocean_handle_t), private, pointer :: h

Source Code

   function handle_create() result(c_handle)
      !! Allocate a new ocean handle and return its opaque C pointer. Caller
      !! (`rdb_ocean_create_from_string`) is responsible for eventually
      !! passing it to `handle_destroy` — including on every early-return
      !! failure path, so a handle that never reached `is_initialised` does
      !! not leak.
      type(c_ptr) :: c_handle
      type(ocean_handle_t), pointer :: h

      allocate (h)
      h%magic = MAGIC_OCEAN
      c_handle = c_loc(h)
   end function handle_create