BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

OMF vs. COFF objects

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Command Line Tools)
View previous topic :: View next topic  
Author Message
Randy Stonesifer
Guest





PostPosted: Fri May 27, 2005 7:17 pm    Post subject: OMF vs. COFF objects Reply with quote



I am porting a combined fortran and c program from unix to Windows. I am
using the Compaq Visual FORTRAN compiler and BC++5.5.1(free command line
version). The CVF uses the Microsoft COFF object file format. BC++ used
OMF. The Microsoft LIB command will add the BC++ objects to a library with
the CVF objects and gives the message that OMF is being converted to COFF.
However, a CVF test program that tries to use the library is not able to
resolve the references to the BC++ symbols.



At

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/LNK4033.asp

It says:

"There are limitations to OMF to COFF conversions. OMF can represent some
things that cannot be represented in COFF. If there are errors when the
linker converts from OMF to COFF, then you will need to use COFF .obj files
instead of OMF .obj files as input to the linker."



Am I missing something simple or am I sc****d?



Is there any way to generate COFF objects with the BC++5.5 I have?



If not, is there another free c compiler that can generate COFF code?



Thanks for any suggestions,

Randy


Back to top
Darko Miletic
Guest





PostPosted: Fri May 27, 2005 10:49 pm    Post subject: Re: OMF vs. COFF objects Reply with quote



Randy Stonesifer wrote:

Quote:
Am I missing something simple or am I sc****d?

You are not missing anything.

Quote:
Is there any way to generate COFF objects with the BC++5.5 I have?

No.

Quote:
If not, is there another free c compiler that can generate COFF code?


Sure. Visual C++ Toolkit 2003. You can get it and use for free at this
address:

http://msdn.microsoft.com/visualc/vctoolkit2003/

Darko

Back to top
Randy Stonesifer
Guest





PostPosted: Fri Jun 03, 2005 4:45 pm    Post subject: Re: OMF vs. COFF objects Reply with quote



After installing the Visual C++ Toolkit 2003, I found the same unresolved
externals. This does not prove that the OMF to COFF conversion done by LIB
worked, but strongly suggests that the unresolved externals were not due to
the BC++ compiler's OMF objects.


Back to top
Bob Gonder
Guest





PostPosted: Fri Jun 03, 2005 7:17 pm    Post subject: Re: OMF vs. COFF objects Reply with quote

Randy Stonesifer wrote:

Quote:
After installing the Visual C++ Toolkit 2003, I found the same unresolved
externals. This does not prove that the OMF to COFF conversion done by LIB
worked, but strongly suggests that the unresolved externals were not due to
the BC++ compiler's OMF objects.

Check the names inside the library.
You can use tlib to generate a listing.

Are you compiling C or C++ code?
Fortran probably doesn't understand the name mangling conventions of
C++, so all C++ functions should be Extern "C"
I also suspect that Fortran, not being C, doesn't follow the C naming
conventions either (that is, adding underscore before all names).
Try making all of your C functions _stdcall, or if that messes up the
stack, remove _stdcall and flip the compiler switch that turns off
underscores (note that that messes up your using the C runtime
library....example: you would need to replace strcpy() with _strcpy()
in your code)




Back to top
Randy Stonesifer
Guest





PostPosted: Mon Jun 06, 2005 1:28 pm    Post subject: Re: OMF vs. COFF objects Reply with quote

Quote:

Are you compiling C or C++ code?
Fortran probably doesn't understand the name mangling conventions of
C++, so all C++ functions should be Extern "C"
I also suspect that Fortran, not being C, doesn't follow the C naming
conventions either (that is, adding underscore before all names).
Try making all of your C functions _stdcall, or if that messes up the
stack, remove _stdcall and flip the compiler switch that turns off
underscores (note that that messes up your using the C runtime
library....example: you would need to replace strcpy() with _strcpy()
in your code)

I was finally able to resolve all externals and get a usable library.


The files are c not c++.

I set the c++ compiler to __stdcall.

The c code developers had a symbol called UPPER that when defined (it was
not well documented) did a lot to help the name conventions.

The unix gettimeofday function was functionally identical to a Windows
Compaq Fortran portablility routine called RTC.

Finally I resolved the unresolved external ftol2 by including a c++ file I
found on the web.
http://www.codecomments.com/archive292-2004-5-196083.html
http://www.manusoft.com/Resources/ARXTips/Main.stm
The error is caused by a hidden internal libary used by the compiler to
convert from floating point to long called __ftol.

In VC7 compilers there is a new version used called __ftol2.
Since I am using VC6 libraires I had to define this to make it use the old
one:

#if (_MSC_VER >= 1300) && (WINVER < 0x0500)
//VC7 or later, building with pre-VC7 runtime libraries
extern "C" long _ftol( double ); //defined by VC6 C libs
extern "C" long _ftol2( double dblSource ) { return _ftol( dblSource ); }
#endif



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Command Line Tools) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.