From: Dan Sugalski [dan@sidhe.org] Sent: Friday, October 20, 2000 2:49 PM To: Info-VAX@Mvb.Saic.Com Subject: Re: Calling C++ from FORTRAN At 03:49 PM 10/20/00 +0000, David Mathog wrote: >In article <39F04B07.63F3D626@ipact.com>, Earl Lakia writes: > > > >Has anyone tried to instantiate a C++ Class from > >FORTRAN, I would be interested. Also calling the > >methods or accessing the properties as well. > >Even if this required calling a C++ stub to > >instantiate the object and call the methods. > > > >I guess one would have to use CXLINK to link > >the program as well. > > > >I examined the FORTRAN manual and it seemed > >a bit brief referencing the OpenVMS calling standard. > > > >The OpenVMS calling standard is the least of your worries. The problem is >that you're at the very least going to have to determine which of the >myriad mangled C++ entry points is the one you really want. And even >then I'm not sure that the linker will put the right pieces in to >instantiate everything unless the first thing to run is also C++. The trick is to write a set of wrapper routines in C++ that are exactly the names you want exported, wrapped in a big 'extern "C"' block. You have to be a bit careful and make sure everything gets destroyed properly in the calling code (no stack-based destruction AFAIK), but it does work. Dan --------------------------------------"it's like this"------------------- Dan Sugalski even samurai dan@sidhe.org have teddy bears and even teddy bears get drunk