I'm trying to create a pthread interface in Fortran 90/95 for the C pthread_create( ) function (see below). I can't use Fortran 2003 or OpenMP for portability reasons.
Passing the first two parameters is by reference, which isn't hard. What's tricky is the third parameter, the address of the (sub)routine that you want to run in a thread, and the fourth parameter which is the address of the [arbitrary] data that you want to pass to the (sub)routine as the first (sub)routine parameter. Can anyone help with the tricky interface specification? Or can someone make available the source code for the IBM f_pthread module, which has already solved this problem?
int pthread_create (pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void*), void *arg);
interface
integer function pthread_create (thread, attr, start_routine, arg)
byte, dimension(8), intent(out) :: thread
byte, dimension(176), intent(in) :: attr
!dec$ attributes c :: pthread_create
!dec$ attributes reference :: thread, attr
!??? how do you declare the 3rd and 4th dummy arguments, and how are they passed?
end interface




