- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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 kopiert
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Those pesky string lengths! Got the code compiling now after adding the string lengths.
Many thanks.
- RSS-Feed abonnieren
- Thema als neu kennzeichnen
- Thema als gelesen kennzeichnen
- Diesen Thema für aktuellen Benutzer floaten
- Lesezeichen
- Abonnieren
- Drucker-Anzeigeseite