Nп/п : 53 из 100
 От   : db                                  2:5075/128        04 сен 23 16:43:38
 К    : All                                                   04 сен 23 17:45:02
 Тема : Calling a C++ function from Forttran
----------------------------------------------------------------------------------
                                                                                 
@MSGID: 1@dont-email.me> e2827ca3
@REPLYADDR db <dieterhansbritz@gmail.com>
@REPLYTO 2:5075/128 db
@CHRS: CP866 2
@RFC: 1 0
@RFC-Message-ID: 1@dont-email.me>
@TZUTC: 0200
@PID: Mozilla/5.0 (X11; Linux x86_64; rv:102.0)
Gecko/20100101 Thunderbird/102.15.0
@TID: FIDOGATE-5.12-ge4e8b94
I see that rather than try to convert a C++ function to
Fortran, it might be better to call it from a Fortran
program. So I found a description of how to do it, and
it involves an interface:

interface
subroutine normal_vec(seed, n, x) bind(c)
import c_int, c_double
integer(kind=c_int), intent(in), value :: seed, n
real(kind=c_double)                    :: x(n)
end subroutine normal_vec
end interface

This is for an example of a random number generator.
I note a declaration of the variable type c_double.
The function I want to call declares "long double"
but I doubt that I can use

import c_long double
...
real(kind=c_long double) :: t, JBAND

where t is the variable passed to the function JBAND


What should I put there?
-- 
Dieter Britz
 --- Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.15.0
 * Origin: A noiseless patient Spider (2:5075/128)
SEEN-BY: 5001/100 5005/49 5015/255 5019/40 5020/715
848 1042 4441 12000
SEEN-BY: 5030/49 1081 5058/104 5075/128
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх