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

Linking Intel Fortran with static (matlab) libraries

ingo_berg
Beginner
384 Views
Hi,

I'd like to know if anyone has experience in linking then intel fortran compiler with the matlab libraries under Windows.

libmx.lib, libmex.lib, libmat.lib

The version of matlab I have acess to comes with precompiled libraries for borland, microsoft (C++), watcom and digital (fortran).
Previousely I used the versions for digital fortran together with compaq visual fortran. Unfortunately they do not seem to work with the Intel compiler since I get a long list of undefined reference error messages.

Since I'm not familiar with the differences in the calling conventions and symbol storage, I'd like to know if it is possible to use old static libraries that were originally designed for compaq fortran (digital fortran) with the Intel compiler.

Regards,
Ingo
0 Kudos
2 Replies
Steven_L_Intel1
Employee
384 Views
Generally, no. Any object or static library that was compiled by DVF/CVF needs to be recompiled with Intel Visual Fortran. I'm not very familiar with Matlab, but I know that people have used MEX files successfully with Intel Fortran. My understanding is that Mathworks is working on an Intel Fortran compatible version. You should contact them for details.
0 Kudos
edmund_dunlop
Beginner
384 Views
Ingo,
Taken from previous contributions from Jugoslav and Steve
(i) You may need DFORRT.dll from DVF. It's available for download within the CVF redistributable kit VFRUN66BI.exe:
See
http://h21007.www2.hp.com/dspp/tech/tech_TechDocumentDetailPage_IDX/1,1701,7161,00.html
or
ftp://ftp.compaq.com/pub/products/fortran/vf/

(ii) This is what will get you CVF calling semantics:

!DEC$ ATTRIBUTES STDCALL,REFERENCE,DECORATE,MIXED_STR_LEN_ARG,ALIAS:"FOO" :: FOO
where FOO is the routine name.
MIXED_STR_LEN_ARG isn't documented but it works. You need the DECORATE and ALIAS because STDCALL will default to downcasing the name.
To implement in your own case, I think it should work if you declare an interface for every routine you want to call from the DVF library:
interface
subroutine FOO1()
!DEC$ ATTRIBUTES STDCALL,REFERENCE,DECORATE,MIXED_STR_LEN_ARG,ALIAS:"FOO1" :: FOO1
end subroutine FOO1

subroutine FOO2()
!DEC$ ATTRIBUTES STDCALL,REFERENCE,DECORATE,MIXED_STR_LEN_ARG,ALIAS:"FOO2" :: FOO2
end subroutine FOO2

etc.
end interface

I have done something similar to this to use Camaimasoft's f90SQL library with IVF and it works fine.

Regards,
Edmund.
0 Kudos
Reply