Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29392 Diskussionen

Linking libraries with different calling conventions

OP1
Neuer Beitragender III
826Aufrufe

I would like to know if it possible to link in my main program libraries which must be called with different calling conventions.

For instance, I have subroutines I need to call from library A with these conventions: CVF / Upper Case / After Individual String Argument. Subroutines from library B must be called with the default IVF 10.1 settings.

Is it possible? If so, how can I do this, since the project properties (for External Procedures)apply to all external subroutines?

Thanks in advance,

Olivier

0 Kudos
3 Antworten
Steven_L_Intel1
Mitarbeiter
826Aufrufe

You do this by declaring an explicit interface for the routine you want to call and, if necessary, adding attributes to change the conventions. In your situation, I would suggest that the CVF-convention routines be declared with an ATTRIBUTES line like this:

!DEC$ ATTRIBUTES STDCALL, REFERENCE, MIXED_STR_LEN_ARG, DECORATE, ALIAS:"FUNCNAME" :: funcname

This would go inside an INTERFACE block declaring function funcname. In the ALIAS attribute, spell the name in uppercase. You would then need to make this interface visible to the caller - creating a module with the declarations and USEing the module is the easiest way.

OP1
Neuer Beitragender III
826Aufrufe

Thanks Steve! It does wonders.

Olivier

Steven_L_Intel1
Mitarbeiter
826Aufrufe
I will comment that we'll be adding a "CVF" attribute in a future version to make this simpler.
Antworten