Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Basical problem with Fortran

patuco
Beginner
544 Views
Hi everyone,
i am asking for help due to my lack of acknowledge in Fortran, so if anyone could give me a hand, it would be perfect.
I had to create a Fortran library with some fortran subroutines(i did not implement them and even can change, so i am asking for help). The purpose was to create a java app to communicate with this lib, due to it calculates some values through different routines.
So the fortran program has a main subroutine:
SUBROUTINE MLVG
which calls a subroutine which calculates everything using two global variables (DCOM and RDCOM)
The java interface calls somenatives that change the values ofthis variables, and get the values from the lib to show them on the screen,e.g.:
SUBROUTINE CALLDEFA()
!MS$ATTRIBUTES DLLEXPORT,STDCALL,ALIAS:'_Calldefa@0'::CALLDEFA
INCLUDE 'COM_MASE.LVG'
DCOM ='DEFA'
END
So my problem, as you can imagine, is how can i do to stop the main subroutine and do nothing till the value of the global variables are changed by the natives.
I tryed with read and a while loop like, but it blocks the progrma till something is read, so the native call can not be done:
SUBROUTINE MLVG
INCLUDE 'COMMON.LVG'
do while (.NOT.DCOM.EQ.'EXIT')
READ(*,'(A4,A72)',ERR=1,END=100)DCOM,RDCOM

WRITE(*,*)' DEBUGGER COMANDO'
WRITE(*,*) DCOM
CALL COMLVG
DCOM= ''
RDCOM=''
enddo
END

Please, if anyone has any suggestion?
Many Thanks
0 Kudos
4 Replies
Jugoslav_Dujic
Valued Contributor II
544 Views
Unless you have more than one thread or process involved, the main routine will wait until the called routine completes. In other words, any call to Native code will be modal unless there's an explicit thread creation somewhere. Is there?
0 Kudos
patuco
Beginner
544 Views
Many thanks for the answer Jugoslav,
I thought and wad afraid for what you said, the neccesity of a thread implementation, because, as i commented before, i have no experience whith fortran, so i have no idea how to create a thread.
If anyone could recommend me a tutorial or somethig similar to implement it would be great.
Thanks
0 Kudos
Jugoslav_Dujic
Valued Contributor II
544 Views
Now I'm confused. In the first post you said that you don't know how to wait for the library to complete. After I said that it's the default behavior, now you tell me that you need a thread?

You will need a thread only if the calculation takes a long time to complete. During that time, GUI will be stuck and the window cannot repaint itself.
0 Kudos
patuco
Beginner
544 Views

Sorry for the delay, it was impossible to answer before.

ok Jugoslav let me explain the confussion then: when i posted this message maybe i was not enough clear. The idea of using threads were present(maybe you do not remember but i posted something close to it and you help me with another good subject about threads) but i was wondering if any other possibility was available.With your answer, it was clear the path to follow. And of course thanks for all the help.

0 Kudos
Reply