Board index » cppbuilder » calling fortran from C++ Builder 5.5
Mike S
![]() CBuilder Developer |
Mike S
![]() CBuilder Developer |
calling fortran from C++ Builder 5.52005-12-17 05:29:00 AM cppbuilder71 I need to call a fortran subroutine (ADS optimization code) from C code, and I am having some trouble compiling. When I try to do so, I get an error stating the following: "Unresolved external '_ADS' referenced from ctopt.obj" Any suggestions on what this means? What is the proper way to call fortran subroutines using Borland C++ Builder 5.5? Currently I am calling it with ADS(......). Thanks. Mike |
Bob Gonder
![]() CBuilder Developer |
2005-12-17 10:57:34 PM
Re:calling fortran from C++ Builder 5.5
Mike S wrote:
QuoteI need to call a fortran subroutine (ADS optimization code) from C code, and If you did, then you need to find out the exact name of the function as it appears in the obj or lib. Use TLIB or TDUMP to find out. Once you know the true name of the function, you can futz with underline, capitalization, and other name mangling issues. |
Mike S
![]() CBuilder Developer |
2005-12-21 10:17:42 PM
Re:calling fortran from C++ Builder 5.5
"Bob Gonder" < XXXX@XXXXX.COM >wrote in message
QuoteMike S wrote: I used TLIB to extract the obj files from the fortran lib file. I also ran tdump and all references to the subroutines and functions are with capital letters without underscores. However, now when I try to link in all the obj files (both c and fortran), I get an error stating the following: Fatal: Unsupported 16-bit segment(s) in module ads12.for Any suggestions? Thanks again for the help. Mike {smallsort} |
Bob Gonder
![]() CBuilder Developer |
2005-12-21 11:58:46 PM
Re:calling fortran from C++ Builder 5.5
Mike S wrote:
QuoteFatal: Unsupported 16-bit segment(s) in module ads12.for 2) Use a 16bit C compiler. The third way is called thunking and I never figured that out. Going between 16 and 32 bit compiled code is extreemely tricky as the 16bit code expects to be working with AX by default while the 32bit expects EAX to be default, and Segment registers are different from Selector registers, even though they are the same register, and addresses are 16 instead of 32 bits, so everything must be translated. Very hairy. |