Board index » cppbuilder » Linker Error: Invalid OMF record, type 0x21

Linker Error: Invalid OMF record, type 0x21

I get a linker error "XYZ.LIB contains invalid OMF record, type 0x21" when
trying to link to external libraries. There is a note on Borlands website
explaining the problem, but it says "if the LIB is an implib use Borlands
implib to regenerate the .lib file from the DLL, and if it is a true library
then recompile the source....". The problem is I DON'T HAVE THE SOURCE! The
.lib I am linking to is from Microsoft and Bill doesn't give source code
away.

Is there a way to work around this problem?

Specifically, I am trying to use OLEDB.LIB from Microsoft, and it is NOT an
implib. It is an old fashioned static library.

 

Re:Linker Error: Invalid OMF record, type 0x21


Quote
"Dean G" <de...@flash.net> wrote:

>  Specifically, I am trying to use OLEDB.LIB from Microsoft, and it is NOT an
>  implib. It is an old fashioned static library.

I am sad to say you may be stuck. Borland's linker does not support
the Win32 standard COFF. Why, I don't know.

Robert Chafer

Re:Linker Error: Invalid OMF record, type 0x21


Quote
>>I get a linker error "XYZ.LIB contains invalid OMF record, type 0x21" when

trying to link to external libraries.

The LIB was probably built with VC++ which uses the COFF format (Inprise
uses OMF).

Quote
>>Is there a way to work around this problem?

You need to get MS to provide a Inprise-compatible version of the library
(not likely).

--
Kent (TeamB and TurboPower Software)

Re:Linker Error: Invalid OMF record, type 0x21


Thanks for your reply, Kent. I believe you are right, but does Inprise has
anything to say about this? This leaves us dead in our tracks and we have no
choice but to avoid Inprise products in the future. I don't think saying
this is a Microsoft problem helps Inprise customers a bit.
Quote
>The LIB was probably built with VC++ which uses the COFF format (Inprise
>uses OMF).

>You need to get MS to provide a Inprise-compatible version of the library
>(not likely).

>--
>Kent (TeamB and TurboPower Software)

Re:Linker Error: Invalid OMF record, type 0x21


Hi Kent,
would it be very hard for inprise to use and generate both: COFF and OMF ?
Inprise should be compatible with M$, because of the OS.
    Heiko

Kent Reisdorph (TeamB) schrieb in Nachricht
<6runma$h...@forums.borland.com>...

Quote
>>>I get a linker error "XYZ.LIB contains invalid OMF record, type 0x21"
when
>trying to link to external libraries.

>The LIB was probably built with VC++ which uses the COFF format (Inprise
>uses OMF).

>>>Is there a way to work around this problem?

>You need to get MS to provide a Inprise-compatible version of the library
>(not likely).

>--
>Kent (TeamB and TurboPower Software)

Re:Linker Error: Invalid OMF record, type 0x21


Quote
> Thanks for your reply, Kent. I believe you are right, but does Inprise has
> anything to say about this? This leaves us dead in our tracks and we have no
> choice but to avoid Inprise products in the future. I don't think saying
> this is a Microsoft problem helps Inprise customers a bit.

Are you *sure* OLEDB.LIB is a static lib, and not an import lib?  Usually
Microsoft does all their stuff in DLLs and just ships around static libs.

But beyond even the format problem, static libraries are not and never
will be cross-compiler.  There's all sorts of naming issues, RTL issues,
and memory issues that aren't "standard" by any means, and in many cases
are proprietary.  No compiler vender can use another's static libraries.

The one way around this is to build a DLL in MSVC and export some wrapper
functions and use that in BCB.

+===================================================+
| Jonathan Arnold (mailto:jdarn...@buddydog.org)    |
| Senior Engineer           Roger Wagner Publishing |
| http://people.ne.mediaone.net/jdarnold            |
+===================================================+

"In order to keep a true perspective of one's importance, everyone
 should have a dog that will worship him and a cat that will ignore
 him." -- Dereke Bruce

Re:Linker Error: Invalid OMF record, type 0x21


It's not difficult at all, that's why Inprise includes implib and impdef.  
Rolling your own import library takes very little time once you've done
it a time or two.  Static libraries, on the other hand are not cross compiler
no matter what format they use.  With static libraries it is not a M$ vs
Inprise issue.

Jeff Overcash

In article <6s068a$j...@forums.borland.com>, "Heiko Weiss"

Quote
<HeikoWe...@haas-laser.de> wrote:
>Hi Kent,
>would it be very hard for inprise to use and generate both: COFF and OMF ?
>Inprise should be compatible with M$, because of the OS.
>    Heiko

Re:Linker Error: Invalid OMF record, type 0x21


Quote
>>I believe you are right, but does Inprise has

anything to say about this?

What can they say? MS departed from the the-standard OMF format a few years
back.

Quote
>>This leaves us dead in our tracks and we have no

choice but to avoid Inprise products in the future.

That's your choice, I reckon.

Quote
>>I don't think saying this is a Microsoft problem helps Inprise customers a

bit.

What would you have them say? Any suggestions?

--
Kent (TeamB and TurboPower Software)

Re:Linker Error: Invalid OMF record, type 0x21


Quote
>>would it be very hard for inprise to use and generate both: COFF and OMF ?

Yes, it would be a very, very big job for Inprise to change to COFF format
at this point. Much bigger than most people think.

Quote
>>Inprise should be compatible with M$, because of the OS.

The OS has nothing to do with linker formats.

--
Kent (TeamB and TurboPower Software)

Re:Linker Error: Invalid OMF record, type 0x21


Changing to COFF will not help a bit. Because differences exist in how
compilers mangle names, how they lay out objects, how they handle
exceptions, RTTI, etc. No way static libs can be mixed.

Alex

Quote
Heiko Weiss wrote:

> Hi Kent,
> would it be very hard for inprise to use and generate both: COFF and OMF ?
> Inprise should be compatible with M$, because of the OS.
>     Heiko

> Kent Reisdorph (TeamB) schrieb in Nachricht
> <6runma$h...@forums.borland.com>...
> >>>I get a linker error "XYZ.LIB contains invalid OMF record, type 0x21"
> when
> >trying to link to external libraries.

> >The LIB was probably built with VC++ which uses the COFF format (Inprise
> >uses OMF).

> >>>Is there a way to work around this problem?

> >You need to get MS to provide a Inprise-compatible version of the library
> >(not likely).

> >--
> >Kent (TeamB and TurboPower Software)

Re:Linker Error: Invalid OMF record, type 0x21


Hi Kent,
I think it would help, when Inprise could add a tool like COFF2OMF like
OMF2COFF that we could use BCB-Dlls with import libraries in M$-VC++.

BTW, COFF2OMF cannot manage C++ functions/classes only 'extern "C"
_stdcall'.
Is it a 'very, very big job for Inprise to' modify COFF2OMF so that we can
use VC++ C++ functions with a import library.
The same problem is in implib / impdef.
When using impdef on a dll with c++ functions we get something like
    ?Function@@YA?AVTest@@V1@@Z @20  .

I don't want Inprise to change there OMF format.
What I'd like to have are tools to use and generate the COFF format. Not for
static libraries, but for import libraries and dll's and for C++ fuctions.

Is this to much fo Inprise ? :-((

TIA
        Heiko

Re:Linker Error: Invalid OMF record, type 0x21


Quote
>>What I'd like to have are tools to use and generate the COFF format. Not

for
static libraries, but for import libraries and dll's and for C++ fuctions.

Uh... why? If you have a DLL it's a simple matter to create an import
library for that DLL. Not as easy in VC++ as with BCB (using IMPLIB), but
still not difficult. Regardless, you will never be able to export classes or
functions not declared extern "C" from DLLs due to name mangling.

--
Kent (TeamB and TurboPower Software)

Re:Linker Error: Invalid OMF record, type 0x21


Quote
>Regardless, you will never be able to export classes or
>functions not declared extern "C" from DLLs due to name mangling.

:-(((

Other Threads