- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using a C++ API function called from a Fortran routine.
The call code is
SIDOK = SIDPUTVOL(%VAL(J2),%VAL(D2),%VAL(VCLASS),%VAL(TVOL))
the C++ code is
VARIANT_BOOL __stdcall SIDPUTVOL(long origin, long dest, long vclass, float volume)
when I use IFORT 'TVOL' is passed to 'volume' correctly
When i use IFX 'volume' takes either zero or e-37
Tvol and volume are both 4 byte real. the integer values are passing correctly.
Can anyone help?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Check the reference manual for C Interoperability.
You should declare an interface to SIDPUTVOL something like:
interface
function SIDPUTVOL(J2, D2, VCLASS, TVOL) bind(C,name='SIDPUTVOL') result(ret)
use, intrinsic :: ISO_C_BINDING
implicit none
integer(kind=c_long), value :: J2, D2, VCLASS
real(kind=c_float), value :: TVOL
logical(kind=c_bool) :: ret ! ** guessing at this
end function SIDPUTVOL
end interface
Place the interface in a module and use that module where you make calls to SIDPUTVOL
Also, in your C++ code add a prototype
extern "C"
VARIANT_BOOL SIDPUTVOL(long origin, long dest, long vclass, float volume);
And make the actual declaration match.
Jim Dempsey
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Check the reference manual for C Interoperability.
You should declare an interface to SIDPUTVOL something like:
interface
function SIDPUTVOL(J2, D2, VCLASS, TVOL) bind(C,name='SIDPUTVOL') result(ret)
use, intrinsic :: ISO_C_BINDING
implicit none
integer(kind=c_long), value :: J2, D2, VCLASS
real(kind=c_float), value :: TVOL
logical(kind=c_bool) :: ret ! ** guessing at this
end function SIDPUTVOL
end interface
Place the interface in a module and use that module where you make calls to SIDPUTVOL
Also, in your C++ code add a prototype
extern "C"
VARIANT_BOOL SIDPUTVOL(long origin, long dest, long vclass, float volume);
And make the actual declaration match.
Jim Dempsey
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page