Subj : Re: Bad object file in record (Newbie to Borland) To : borland.public.cpp.borlandcpp From : Bob Gonder Date : Fri Jul 09 2004 07:24 pm Richard wrote: >I am a new user to borland and am currently using Borland C++ version 5. Welcome. BTW, If you turn on line wrapping, it makes reading and replying to your posts easier. > I have a requirement to import a dynamic link library built using VC6++. > As I understand it, I use the implib for the .dll to convert the file. Eg. >c:\bc5\bin\implib 'target.lib' 'source.dll' >This works fine and I am able to run my program in WIN32, Console mode. Yep, so far very good. > However, I have a requirement to use this under DOS mode. Not so very good. >When I try to compile and link the file again using DOS mode, I get the error message. > >'Bad object file record in library file. module DllMain near module file offset 0x0000002B' > >Questions... >1. Can anyone explain the difference between DOS and Win32 support? DOS is 16 bit, Win32 is 32 bit. The memory addressing is totally different, and the size of parameters passed on the stack are different. There are supposed to be methods floating around called "thunk"ing, but I never could find enough info, or figure out how to use it (I also wanted to use it with a normal lib, not a dll). Is the DLL written for 32bit or 16 bit code? Probably 32 bits these days, which doesn't play nice with 16bit DOS apps. I suspect that VC6 only supports 32bits, but don't know for sure. You're probably out of luck getting a VC DLL to work with a DOS app. Q1: Does it *really* need to be DOS? Perhaps a Windows Console application (32 bit) would do the job? (Guess not, as you already have that) Q2: Does it *really* need to be a VC6 DLL? Couldn't you work it out so it's compiled as a normal DOS Lib file? Perhaps you could even use BC++5 itself to compile it ! >2. Presumably it's OK to call DLL's from DOS applications. Am I right in assuming this. Never done it myself. BC++3 claimed to support it, but my recolection was that they were Borland DOS DLLs that were supported, and not the 16 bit Windows 3.x that was out at the time, but could be mistaken. I seem to recall one of the TeamB'ers saying it worked with Windows DLLs, but again, the crystal ball is fuzzy on that. >3. Can anyone help me to try and resolve this issue. I see only 4 solutions. 1) Write everything for DOS. 2) Write everything for Win32 (console or GUI) 3) Investigate thunking which may or may not work for you. 4) Investigate DOS Extenders that put the cpu in (I always forget what's real and what's protected) essentially the same mode as Win32 (32 bit addressing, flat memory space), where you stand a better chance of the 32bit VC code working. Mind you, no guarantees from me on 3 or 4. .