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 on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

Symbols not affected by /names:uppercase

gjm
Beginner
1,633 Views
I have a FORTRAN main program calling a C DLL. The C DLL uses all uppercase names. When I compile the FORTRAN I use /names:uppercase. I am getting two unresolved symbols that are showing in the error message as lower case. Before I corrected most of my unresolved symbol errors by correcting include and library paths I was getting most of my unresolved symbols as capital names. But these two are lower case and I do not understand why the compiler is not changing the case to upper.

cgwrite.obj : error LNK2019: unresolved external symbol _cg_goto_f referenced in function _MAIN__

cgwrite.obj : error LNK2019: unresolved external symbol _cg_array_write_f referenced in function _MAIN__

The symbols in question are the only ones that use

!DEC$ ATTRIBUTES REFERENCE, C, VARYING :: cg_goto_f
!DEC$ ATTRIBUTES REFERENCE, C, VARYING :: cg_array_write_f

I am not the author of the code but I thinkthe above are usedbecause these calls have variable argument lists. I have tried capitalizing them in the FORTRAN but it does not help. The calls are being made to

_declspec(dllexport) void CG_GOTO_F(cgsize_t *fn, cgsize_t *B, cgsize_t *ier, ...)

I am using IVF 11.1.065 and MSVS 2005.

Hope somebody can set me straight.

Thanks
Greg

0 Kudos
3 Replies
Steven_L_Intel1
Employee
1,633 Views
The ATTRIBUTES C overrides the /names and specifies lowercase. You can add

, DECORATE,ALIAS:"CG_GOTO_F"
and
,DECORATE,ALIAS:"CG_ARRAY_WRITE_F"

to get uppercase names.
0 Kudos
gjm
Beginner
1,633 Views

Steve,

Thanks for your help. You got me on the right track but with the DECORATE it kept telling me "Only a function or subroutine subprogram may have the !DEC$ ATTRIBUTES directive DECORATE specifier". I ended up decorating the subroutine name myself and it compiles and links.

!DEC$ ATTRIBUTES REFERENCE, C, VARYING :: _cg_goto_f

I'll have to test to see that it works right but at least I am moving again. Getting C and FORTRAN to play nice is an ever constant journey for me. This is another brick in the wall I will have to record.

Thanks
Greg

0 Kudos
Steven_L_Intel1
Employee
1,633 Views
I have seen that error and adding an EXTERNAL declaration can help. Or, better, an explicit interface. You may also want to look at the Fortran 2003 C interoperability features we support.

I strongly recommend use of DECORATE rather than adding the decoration manually as that means your code will be portable to x64.
0 Kudos
Reply