aboutsummaryrefslogtreecommitdiff
path: root/src/clp_callback.f90
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2020-10-29 16:10:53 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2020-10-29 16:10:53 -0400
commit9b380489a4084097380b18f58bb2116613f891ee (patch)
treeedbb313fdd5bf3246d866d6d691d7aa22b92ded4 /src/clp_callback.f90
parent9fac184765c3756de6b22cf110a6fc3f626d2fe1 (diff)
downloadclp_fortran-9b380489a4084097380b18f58bb2116613f891ee.tar.gz
clp_fortran-9b380489a4084097380b18f58bb2116613f891ee.zip
Implemented the C example driver program in Fortran. Updates to name routines to read rather than write when appropriate. Minor callback fixes.
Diffstat (limited to 'src/clp_callback.f90')
-rw-r--r--src/clp_callback.f9011
1 files changed, 7 insertions, 4 deletions
diff --git a/src/clp_callback.f90 b/src/clp_callback.f90
index d403be7..905d575 100644
--- a/src/clp_callback.f90
+++ b/src/clp_callback.f90
@@ -25,6 +25,7 @@ contains
nString, vString) bind(C)
use iso_c_binding
use clp_constants
+ use clp_interface_utils
implicit none
type(c_ptr), value :: model
@@ -34,8 +35,8 @@ contains
real(kind=c_double), dimension(:), pointer :: fdouble
integer(kind=c_int), dimension(:), pointer :: fint
- character(len=clp_default_message_len), dimension(:), pointer :: fstrs
-
+ character(len=clp_default_message_len), dimension(:), allocatable, target :: fstrs
+ character(len=clp_default_message_len), dimension(:), pointer :: fstr_pointer
! For converting C strings
type(c_ptr), dimension(:), pointer :: c_strings
integer::i
@@ -55,14 +56,16 @@ contains
do i = 1, nString
call populate_fortran_string(c_strings(i), fstrs(i))
end do
+
+ fstr_pointer => fstrs
end if
! Now that Fortran arrays are built, call the Fortran callback
if(associated(current_callback)) then
- call current_callback(model, messageNumber, fdouble, fint, fstrs)
+ call current_callback(model, messageNumber, fdouble, fint, fstr_pointer)
end if
- if(associated(fstrs)) then
+ if(allocated(fstrs)) then
deallocate(fstrs)
end if