I hadn't encountered 'mangling' till installing CXX but I'm having some problems linking a FORTRAN program which calls a C++ function which then uses GETJPIW
(I've coded quite a lot of FORTRAN in the past but am trying to learn C++ and also use the system services (which I suspect are a good 'selling point' for OpenVMS) which is fine until - like the Cadillac in Johnny Cash's song - I try to fit them together.:
%LIBRAR-W-COMCOD, compilation warnings in module GET_ALL_PROCESSES file SYS$SYSD
%LINK-W-NUDFSYMS, 1 undefined symbol:
%LINK-W-USEUNDEF, undefined symbol GET_ALL_PROCESSES referenced
in psect $LINK$ offset %X000001C0
in module GET_PROCESSES file SYS$SYSDEVICE:[USER.DAVE.PROC_WATCH]PROCESS
%DCL-W-SKPDAT, image data (records not beginning with "$" ) ignored
After trying a few things llike shortening the function name GET_ALL_PROCESSES to GETPROCS and adding 'underscores', I searched the object file produced by the CXX and found the 'mangled' version of my function name
and put this in my Fortran routine
INTEGER GETPROCS__XPCPCIIIIIL ! C++ function
- this links ok.
- Obviously this isn't the way FORTRAN should Call C++, so I wondered if anyone has some advice?
I found this recommendation for the C++ function:
int GETPROCS ( char, char, int, int, int, int, int, long int); - but it didn't seem to help
Edited by somersdave on April 22 2012 10:52
To support function overloading in C++, the C++ compiler generates a different function entry point for each possible set of parameters. Since each entry point must be unique, the C++ compiler encodes the parameter types into the process name.
On VMS, it then may hit the 31 character limit on function names, so it will then calculate a CRC for the original name, and then truncate the symbol name with the CRC result appended to it.
If you look at the symbols produced by C++ compilers on other platforms, you will usually see the type names for each of the arguments appended to the original routine name.
Now generally for all platforms, if you want to have a routine compiled by C++ accessed by a different language, you need an entry point that does not have the parameter types encoded into it.
That is what the extern "C" declares.
The same is true when you are declaring prototypes for non C++ routines to be called by C++ code, you have to use the extern "C" to tell the compiler not to encode the data types into the actual symbol being called.
malmberg December 12 2017 HPE only makes the most current version of OpenVMS Alpha / IA64 /VAX available to hobbyists. When I had access to the Alliance 1 program it was the same. No public downloads are allowed by HPE.
nmbonao December 08 2017 Is anybody knows OpenVMS 8.2 version downloadable version? or CD copy? Thank you very much
aarommes December 02 2017 Bitcoin and Blockchain enthusiasts ( plus distributed computing ) please connec / reply: http://www.openvmshobbyis t.com/forum/viewthread.ph p?forum_id=130&thread_id= 2991
malmberg September 10 2017 https://sourceforge.net/p /vms-ports/wiki/VMSInstal lation/ For the most part just use VMS 6.1 media instead of 7.3. But why run the older release?
DoeveR August 07 2017 Where can I find the write up on running VMS 6.1 using the simh emulator?
Bart March 20 2017 Happy to have found my password again!