 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Mike S Guest
|
Posted: Fri Dec 16, 2005 9:29 pm Post subject: calling fortran from C++ Builder 5.5 |
|
|
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
|
|
| Back to top |
|
 |
Bob Gonder Guest
|
Posted: Sat Dec 17, 2005 2:57 pm Post subject: Re: calling fortran from C++ Builder 5.5 |
|
|
Mike S wrote:
| Quote: | 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"
|
Well, first, did you include the fortran obj or lib in the link
command?
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.
|
|
| Back to top |
|
 |
Mike S Guest
|
Posted: Wed Dec 21, 2005 2:17 pm Post subject: Re: calling fortran from C++ Builder 5.5 |
|
|
"Bob Gonder" <notbg (AT) notmindspring (DOT) invalid> wrote
| Quote: | Mike S wrote:
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"
Well, first, did you include the fortran obj or lib in the link
command?
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.
|
Ok, I'm not sure if I've done this properly; however, I think I'm on the
right track.
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
|
|
| Back to top |
|
 |
Bob Gonder Guest
|
Posted: Wed Dec 21, 2005 3:58 pm Post subject: Re: calling fortran from C++ Builder 5.5 |
|
|
Mike S wrote:
| Quote: | Fatal: Unsupported 16-bit segment(s) in module ads12.for
Any suggestions?
|
Well, 2 ways to go about it.
1) Use a 32bit Fortran compiler.
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.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|