- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Another problem I meet, trying to call a Fortran function from a C++ program :
How can I pass a structure from C++ in the parameter of the Fortran Function ?
Example :
typedef struct _testst (int test1; int test2) testst, *lptestst;
extern "C" void f1(lptest rec);
What does my Fortran function f1 look like ? In fortran side, do I have to declare rec as a COMMON and how ? Is it also possible to declare it as a STRUCTURE (VMS keyword) ?
If you have any example, it would be great !
Thanks in advance for your answer !
링크가 복사됨
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
subroutine f1 (rec) bind(C,name="f1")
use,intrinsic :: iso_c_binding
type, bind(C) :: testst
integer(C_INT) :: test1
integer(C_INT) :: test2
end type testst
type(testst), intent(inout) :: rec
! code goes here
! components are rec%test1 and rec%test2
end subroutine f1
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
integer test1
integer test2
end structure
record /testst/ rec
intent(inout) :: rec
I don't know why you would want to do that rather than the standard-conforming method.
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Well, this is very simple :
My C++ Project has to call Mathematical Fortran Model made by our technical department. This department used to do their model in VAX VMS.
Now they have to migrate it to a Linux server sothey would like to do the less modification as possible.
That's why I want to keep the syntax of VMS Fortran.
Thanks a lot for your answer !
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
The INTENT is optional and is primarily there to aid in error checking.
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
I understand, but the code of this model containt some call to SYS$ of OpenVMS system that cannot be use in linux.
So the code has to be change in this way. Nevertheless, you mean that the actual syntax used for OpenVMS will be applied to the linux system ? Won't I have any problem if I keep for examplea REAL*4 which has to be modified by C++ ?
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고