Sign in to follow this  
White Rabbit

Possible problems with using .obj files to distribute code

Recommended Posts

Hi there =) Possible problems with using .obj files to distribute code I'm thinking about using .obj files to distribute some code, as an alternative to .lib and .dll files. What are the possible problems that might arise from using this alternative? I find close to no reference to this in search engines, so i supose there must be something ultimately wrong with this approuch for it to not even be contemplated by programmers in general. I just don't know what it is. Any input on this will be appreciated. Thank you. ---------------------------------------- Extra info I'm considering using .obj files because my compiler doesn't make .lib files(Visual C++ Toolkit 2003), and i'de preffer not to use .dll's for it's complexity and slitly smaller performance potencial. ---------------------------------------- Question answered! Further search, based on suspections brought up by the posters =), realeaved .obj files are indeed compiler specific, and unsuitable for my current needs. ---------------------------------------- Correction. Visual C++ Toolkit 2003 can create .lib's after all, using the link.exe that comes with it with the /lib option. I missed this because it isn't documented in the help output of link.exe. ---------------------------------------- [Edited by - White Rabbit on September 20, 2004 7:26:08 AM]

Share this post


Link to post
Share on other sites
First of all, what's wrong with .lib or .dll?

Problems you might encounter are:
* Code will very likely break when used on different plattforms.
* Different compilers generate different obj files (especially C++ compilers, even on the same plattform).

I don't think it is a good idea. ;)

Share this post


Link to post
Share on other sites
Just out of curiosity, why are you considering .obj files as an alternative to the "standard" of .lib/.dll files?

Not being up-to-date on details of the different formats, I believe .obj files might be compiler-specific, and unusable with different versions of said compiler... but I could be totally wrong.

The nice thing about DLL files is that not only are they useable among multiple projects, but they don't have to take up hard drive space more than once.

Share this post


Link to post
Share on other sites
Not entirely related to this thread but you can create your own lib.exe as all it really does is call link.exe. Check out this page then go to "Step 6" for a link to source code to an alternate lib.exe.

Haven't tried it myself so I can't vouch for it's effectiveness, but it's worth a try.

Share this post


Link to post
Share on other sites
OMG thank you soo much!

I don't need _a_ lib.exe application, i just need the funtionality, the ability to create a lib, but in that page it explains how to make a lib without the lib.exe, we just use link with /lib =D.

That really helped!

Rate up =)

Share this post


Link to post
Share on other sites
Quote:
Original post by MaulingMonkey
Not being up-to-date on details of the different formats, I believe .obj files might be compiler-specific, and unusable with different versions of said compiler... but I could be totally wrong.


Hi,

AFAIK obj files are standard: see wotsit. IIRC They has been designed by MS and intel in the early DOS days and are still used today.

@OP : there is no point of using .obj instead of .lib. You get the same restriction, since a lib is only a bunch of somewhat prelinked obj files, but you'll have more problem with file coherence (once you have everything in a library you are pretty sure that it has been generated at the same time ; with multiple object files you'll have to guess). DLL is probably the better if you plan to distribute something since you can add a DLL version which will help you during "customer support" (maybe exagerated here, but once you are giving away something, expect to have some return from your users).

HTH,

Share this post


Link to post
Share on other sites
I could be wrong - but aren't .lib files just a collection of .obj files anyway?

Certainly on Unix, .a files are a collection of .o files. I assumed the same thing was true of the DOS/Windows .obj and .lib.

The file format might be standardised, but things like name decoration, struct layout etc, could change between compiler versions (struct layout could even be affected by compiler options), causing the compiled code to either fail to link, or fail to work.

Mark

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this