anchor.diff:         case ('WARNING')
             ! TODO handle warnings
          case ('NEW_X')
  -          ! Call the logging function if one was given
  -          if (c_associated(log_function)) then
  -             ! Compute some of the values not otherwise available
  -             step_length = real_state(4) * real_state(14)
  -             f_delta = abs(real_state(2) - func_value) / &
  -                  max(abs(real_state(2)), abs(func_value), 1d0)
  -             ! Log the information
  -             status_c = log_function_pointer( &
  -                  log_function_callback_data, &
  -                  int_state(30), int_state(36), int_state(34), step_length, &
  -                  dim_c, point, func_value, grad_value, &
  -                  f_delta, real_state(3), real_state(13), g_tolerance_c &
  -                  )
  -             ! Terminate optimization on any error
  -             if (status_c /= LBFGSB_STATUS_SUCCESS) exit
  -          end if
  +          ! Call the logging function
  +          status_c = call_logging_function( &
  +               log_function, log_function_callback_data, &
  +               point, func_value, grad_value, g_tolerance_c, &
  +               int_state, real_state, status_message_c)
  +          ! Terminate optimization on any error
  +          if (status_c /= LBFGSB_STATUS_SUCCESS) exit
          end select
       end do
       ! End optimization
  
positive.code:     ! Fortran versions of arguments
      procedure(objective_function_c), pointer :: func_pointer
      procedure(objective_gradient_c), pointer :: grad_pointer
      procedure(log_function_c), pointer :: log_function_pointer
      real(dp) :: point(dim_c)
      ! Variables and memory for L-BFGS-B
      integer :: print_control
  
negative.code:          2 * approximation_size_c * dim_c + 5 * dim_c + &
           11 * approximation_size_c ** 2 + 8 * approximation_size_c &
           )
  
      !print *, 'lbfgsb_c.f03:lbfgsb_minimize('
      !print *, '  func:', c_associated(func)
  