- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve,
This was a dum q to start, of course the second metod you show should be obvious, as I realized after posting the msg.
Sorry!
Tim
This was a dum q to start, of course the second metod you show should be obvious, as I realized after posting the msg.
Sorry!
Tim
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page