anchor.diff:      end do
   
       ! Analyze task and error state to see how to return
  -    if (error_code_c == 0) then
  +    if (error_code_c == LBFGSB_OK) then
          ! Objective and gradient evaluations were OK but L-BFGS-B may not
          ! be.  Regardless, take what we can from the outputs.
          min_x_c = point
  
positive.code:           ! Call objective function
            error_code_c = func_pointer(dim_c, point, func_value, &
                 callback_data, error_message_length_c, error_message_c)
            if (error_code_c /= 0) exit
  
            ! Call objective function gradient
            error_code_c = grad_pointer(dim_c, point, grad_value, &
                 callback_data, error_message_length_c, error_message_c)
            if (error_code_c /= 0) exit
         end if
  
         ! Nothing to do for other tasks (NEW_X just means a step was
  
negative.code:   implicit none
    private
  
    ! Public procedures
    public lbfgsb_minimize
  
    ! Public constants and error codes
    enum, bind(c)
       enumerator :: &
            LBFGSB_OK = 0, &  ! No error
            LBFGSB_APPROXIMATE, &  ! Approximate result; could not satisfy tolerances
            LBFGSB_RUNTIME_ERROR, &  ! Error in L-BFGS-B or its invocation
            LBFGSB_FUNCTION_ERROR, &  ! Error in computing objective function
            LBFGSB_GRADIENT_ERROR, &  ! Error in computing objective gradient
            LBFGSB_TASK_ERROR  ! Unrecognized task
    end enum
  
    ! Signatures for C callbacks for computing the objective function
    ! value and the objective function gradient
  