Skip to content

Commit

Permalink
Merge pull request #92 from smolins/iso-binding
Browse files Browse the repository at this point in the history
iso_c_binding to latest version
  • Loading branch information
smolins authored Nov 20, 2023
2 parents 211931c + ede72cf commit 6b5091e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions alquimia/alquimia_fortran_interface_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module alquimia_fortran_interface_mod
use AlquimiaContainers_module, only : AlquimiaSizes,AlquimiaProblemMetaData,AlquimiaProperties,&
AlquimiaState,AlquimiaAuxiliaryData,AlquimiaAuxiliaryOutputData, AlquimiaEngineStatus,&
AlquimiaGeochemicalCondition,AlquimiaEngineFunctionality
use iso_c_binding, only : c_funptr
use, intrinsic :: iso_c_binding, only : c_funptr

implicit none

Expand Down Expand Up @@ -35,7 +35,7 @@ module alquimia_fortran_interface_mod
interface
subroutine CreateAlquimiaInterface(engine_name, alq_interface, status) bind(C, name='CreateAlquimiaInterface')
use AlquimiaContainers_module, only : AlquimiaEngineStatus
use iso_C_binding, only: c_char
use, intrinsic :: iso_c_binding, only: c_char
IMPORT
implicit none
character(kind=c_char) :: engine_name(*)
Expand Down Expand Up @@ -144,7 +144,7 @@ subroutine FreeAlquimiaAuxiliaryOutputData(aux_output) bind(C, name='FreeAlquimi
subroutine AllocateAlquimiaGeochemicalCondition(size_name, num_aqueous_constraints, num_mineral_constraints,&
condition) bind(C, name='AllocateAlquimiaGeochemicalCondition')
use AlquimiaContainers_module, only : AlquimiaGeochemicalCondition
use iso_c_binding, only : C_INT
use, intrinsic :: iso_c_binding, only : C_INT
implicit none
integer(C_INT),VALUE :: size_name, num_aqueous_constraints, num_mineral_constraints
type(AlquimiaGeochemicalCondition) :: condition
Expand Down Expand Up @@ -255,7 +255,7 @@ subroutine GetProblemMetaData(pft_engine_state, meta_data, status) bind(C)
contains

subroutine Alquimia_Fortran_setup(this,input_filename,hands_off,pft_engine_state,sizes,functionality,status)
use iso_c_binding, only : c_f_procpointer,c_char,c_bool,c_ptr,C_NULL_CHAR
use, intrinsic :: iso_c_binding, only : c_f_procpointer,c_char,c_bool,c_ptr,C_NULL_CHAR
use AlquimiaContainers_module, only : AlquimiaEngineStatus,AlquimiaSizes,AlquimiaEngineFunctionality,kAlquimiaMaxStringLength
implicit none

Expand Down Expand Up @@ -368,7 +368,7 @@ subroutine Alquimia_Fortran_GetProblemMetaData(this,pft_engine_state, meta_data,

subroutine Create_Fortran_Alquimia_Interface(this,engine_name, status)
use AlquimiaContainers_module, only : AlquimiaEngineStatus,kAlquimiaMaxStringLength
use iso_C_binding, only: c_char,c_null_char
use, intrinsic :: iso_c_binding, only: c_char,c_null_char
implicit none
class(AlquimiaFortranInterface) :: this
character(kind=c_char,len=kAlquimiaMaxStringLength) :: engine_name
Expand Down
8 changes: 4 additions & 4 deletions alquimia/c_f_interface_module.F90
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ subroutine c_f_string_ptr(c_string_ptr, f_string)
! copy a null terminated c string into a fortran string.
! null pointer --> empty string
! empty fortran strings and padding at the end are expected to be spaces.
use iso_c_binding, only : c_ptr, c_char, c_associated, c_f_pointer, c_null_char
use, intrinsic :: iso_c_binding, only : c_ptr, c_char, c_associated, c_f_pointer, c_null_char

implicit none

Expand All @@ -76,7 +76,7 @@ end subroutine c_f_string_ptr
subroutine c_f_string_chars(c_string_chars, f_string)
! copy a c char array reference to fortran
! assumes c char array is properly null terminated to end the loop!
use iso_c_binding, only : c_char, c_null_char
use, intrinsic :: iso_c_binding, only : c_char, c_null_char

implicit none
character(kind=c_char, len=1), intent(in) :: c_string_chars(*)
Expand All @@ -94,7 +94,7 @@ end subroutine c_f_string_chars

subroutine f_c_string_ptr(f_string, c_string_ptr, c_string_len)
! copy a fortran string to a c string pointer
use iso_c_binding, only : c_char, c_ptr, c_associated, c_f_pointer, c_null_char
use, intrinsic :: iso_c_binding, only : c_char, c_ptr, c_associated, c_f_pointer, c_null_char

implicit none

Expand All @@ -121,7 +121,7 @@ end subroutine f_c_string_ptr
subroutine f_c_string_chars(f_string, c_string_chars, c_string_len)
! copy a fortran string to a c string passed by char-array refrence
! c_string_len is the max string length, including null terminator
use iso_c_binding, only : c_char, c_null_char
use, intrinsic :: iso_c_binding, only : c_char, c_null_char

implicit none

Expand Down

0 comments on commit 6b5091e

Please sign in to comment.