- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am attempting to call the ifort zcos function from a C++ main program. For functions that are in libraries I am able to use the technique...
extern "C" MYFUN()
...
MYFUN()
within my C++ code, where MYFUN is a fortran routine in a FORTRAN library. The zcos function, however, appears to be a "builtin" intrinsics and thus keeps coming up as unresolved with this technique.
Any advice or example, greatly appreciated.
Beau Paisley
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't quite understand what you are doing. Are you writing a Fortran function that calls ZCOS? (CDCOS is the preferred name for this function). It should not matter that it is "builtin". Or are you trying to call the math routine directly from C++? Note that this routine returns a double complex result, and Fortran functions that do this pass a hidden first argument for the result.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am writing a C++ function that call the ZCOS, (or DCOS, same problem).
e.g. from within my C++ function
extern "C" ZCOS(double *);
...
ZCOS(&d);
and then link against libm.lib, but ZCOS comes up as undefined, and I suspect it is because it is not actually in any of the fortran libraries. It's built in.
Beau
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This all is an artifact of the z_cos, z_sin, etc. functions being removed from the Intel compiler at version 8. If the fortran-based source code is available, or you know of such I can just compile and link in my own.
Beau
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, the routines were not removed. The ZCOS intrinsic is still supported. However, the name of the external routine it calls is _ccos. Calling the math library routines directly is not supported, and the names can change without notice.
As I noted, ZCOS is an alternate spelling of CDCOS. You could write your own routine as follows:
complex(8) function zcos (arg)
complex(8), intent(in) :: arg
zcos = cdcos(arg)
return
end
You would have to call this from C++ as:
zcos (&result, &arg);
As I noted, ZCOS is an alternate spelling of CDCOS. You could write your own routine as follows:
complex(8) function zcos (arg)
complex(8), intent(in) :: arg
zcos = cdcos(arg)
return
end
You would have to call this from C++ as:
zcos (&result, &arg);

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page