Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.

assume nounderscore + getcwd

crkkos
Beginner
1,148 Views
i have a 1024 character.

i call int x = getcwd(DIR)

dir = "/home/mydirectory/"

If i run the same code, the only difference is, i use the assume nounderscore flag,

dir = "home/mydirectory " with spaces all the way up to 1024.

Why does the flag make a difference? Is there a way i can get the assume nounderscore flag,
make it have the spaces just like without the assume nounderscore flag?





0 Kudos
5 Replies
Steven_L_Intel1
Employee
1,148 Views
My guess is that with assume nounderscore, you're getting a C library version of the routine, rather than the Fortran version. I recommend against using assume nounderscore - use an interface block and BIND(C,NAME="namegoeshere") if you need to call an external routine with non-Fortran conventions.
0 Kudos
crkkos
Beginner
1,148 Views
My guess is that with assume nounderscore, you're getting a C library version of the routine, rather than the Fortran version. I recommend against using assume nounderscore - use an interface block and BIND(C,NAME="namegoeshere") if you need to call an external routine with non-Fortran conventions.

im having to use assume nounderscore since its part of a whole library, i just isolated the problem to this. for some reason also, with the assume nounderscore flag, the value returns is non 0, but with the flag it returns 0.
0 Kudos
Steven_L_Intel1
Employee
1,148 Views
As I said, you're calling the wrong routine. Try adding USE IFPORT in the routine that calls getcwd.
0 Kudos
crkkos
Beginner
1,148 Views
As I said, you're calling the wrong routine. Try adding USE IFPORT in the routine that calls getcwd.

you were right, i traced both version of the code, one with the assume nounderscore and one without it, and looked at the assembly level calls to getcwd, and they were calling different functions. So i added a underscore to the getcwd call and it worked. Thanks Steve, btw, how was japan?
0 Kudos
Steven_L_Intel1
Employee
1,148 Views
I suppose that's another way to do it, though it's not what I would recommend. I hope you add a comment explaining it.

Japan was wonderful. Pictures are here - I'm still working on a travelogue.
0 Kudos
Reply