- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
I need to run an optimization algorithm but the fucntion which returns the value to optimize is use-host associated with the routine which calls the optimizer like this:
I know that I read in the doc that though not standard, CVF does support exporting the use-host routines externally, but the above scheme does not link saying that the func call in Optimizer is unresolved.
Can this really be done? if so how?
moreover, Can the optimizer everbe put in a module and still call a func not inside it?
Thanks, Tim
main: get necessary data & parameters to evaluate function call optimzer CONTAINS function func calculate with data shared by use-host assoc from main end func end main subroutine optimizer ... call func ... end optimizer
I know that I read in the doc that though not standard, CVF does support exporting the use-host routines externally, but the above scheme does not link saying that the func call in Optimizer is unresolved.
Can this really be done? if so how?
moreover, Can the optimizer everbe put in a module and still call a func not inside it?
Thanks, Tim
링크가 복사됨
2 응답
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
In your case, func is not visible at all outside main. Now if main were a module and func was a module procedure, optimizer could USE the module and call func.
The other thing you could do is something like this:
In this case, you must make sure that the function is called with exactly the number of arguments it expects. (Your sample CALLed a function, which is a no-no.)
The above is non-standard, but CVF supports it.
I hope this helps.
Steve
The other thing you could do is something like this:
program main call sub (func) contains integer function func (i) func = i + 1 return end function func end subroutine sub (func) integer, external :: func write (*,*) func(3) return end
In this case, you must make sure that the function is called with exactly the number of arguments it expects. (Your sample CALLed a function, which is a no-no.)
The above is non-standard, but CVF supports it.
I hope this helps.
Steve