- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi guys,
Been trying to figure this out for the last few days but to no avail..
I have a Fortran static library routine calling another Fortran static library routine. The caller code is below:
CHARACTER p_EngLogPair1*MAX_CHOICE_LEN CHARACTER p_EngLogPair2*MAX_CHOICE_LEN IF (ftype .EQ. T_LOGICAL) THEN fluid(-objidx).f(elem_size).logical_text_code = 1 get_logical_pair_index(p_EngLogPair1, p_EngLogPair2) ELSE fluid(-objidx).f(elem_size).logical_text_code = 1 get_engineering_pair_index(p_EngLogPair1, p_EngLogPair2) END IF
Both the get_logical_pair_index and get_engineering_pair_index routines are defined the same as below:
INTEGER*4 FUNCTION get_logical_pair_index (p_True, p_False) !DEC$ATTRIBUTES ALIAS : '_GET_LOGICAL_PAIR_INDEX@8' :: get_logical_pair_index IMPLICIT NONE CHARACTER p_True*10 CHARACTER p_False*10
INTEGER*4 FUNCTION get_engineering_pair_index(extu, intu) !DEC$ATTRIBUTES ALIAS : '_GET_ENGINEERING_PAIR_INDEX@8' :: get_engineering_pair_index IMPLICIT NONE CHARACTER extu*MAX_UNIT_LEN CHARACTER intu*MAX_UNIT_LEN
Both static libraries are compiled with /Gm switch as I use an earlier version of the NAG library that requires the CVF calling convention.
I always get unresolved external 'error LNK2019: unresolved external symbol _GET_LOGICAL_PAIR_INDEX@16' and 'error LNK2019: unresolved external symbol _GET_ENGINEERING_PAIR_INDEX@16'.
I don't understand why the code is trying to link against the @16 version of the routine when the routine is only passing two values.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
CHARACTER arguments pass a hidden length argument as well. Note that Intel Fortran and CVF place these differently, and /Gm isn't going to handle this. /iface:cvf would. This would also eliminate the need for the ATTRIBUTES directive.
My preference would be to not use a switch at all and instead declare interfaces for the NAG routines you're calling, including "!DEC$ ATTRIBUTES CVF :: routine-name" in each one.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I suspect that you did not have your static libraries (and the application that uses these libraries) working at some earlier time (?).
The first code fragment that you showed raised this flag: the implicit type of functions with names starting with 'g', such as get_logical_pair_index, is REAL. If you want it to be INTEGER*4, you need an explicit type declaration to make that happen.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Those pesky string lengths! Got the code compiling now after adding the string lengths.
Many thanks.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page