Solved

Problem generating libraries

Posted on 1998-12-08
5
861 Views
Last Modified: 2008-03-03
Using VC++5 I generate a LIB file.

If I then try and link it with a project (in debug mode) and after
bodging around the incompatible library errors I finely get it to
link but when I run it I get:

Could not execute: Invalid directory(Win32 error 267)

So does this mean if you send someone a LIB you have to send all flavours
they will use? (eg Debug, release single thread, multi etc)

An is this the advantage of a DLL?

Thanks Chris.

0
Comment
Question by:chrishart
  • 3
  • 2
5 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 200 total points
Comment Utility
The same is true of DLLs.  You can't mix single and multi-threaded and you can't mix debug and release.  All use different run-time libraries.  (technically with some care you might be able to, but basically, no you can't).
0
 
LVL 22

Expert Comment

by:nietod
Comment Utility
I didn't really spell it out, so just in case, yes, with LIBs or with DLLs you must send each "flavor" they need.
0
 

Author Comment

by:chrishart
Comment Utility
Ahh I see.

But before I close this "thread" ;-)

I've seen DLLs avialale to do all sors of things. I've never seen different versions ....

I can see that you need different versions of LIBs - ok I accept that but why a debug DLL for example. Isnt the dll self contained and has its own library copies?

May be that's what you mean bt "technically with some care you
   might be able to"?

I can a single thread DLL won't work in a mutithred system

Thanks for your prompt reply.

Chris
0
 
LVL 22

Expert Comment

by:nietod
Comment Utility
>> I've seen DLLs avialale to do all sors of things.
>> I've never seen different versions
If you mean DLLs that ship with a finished product, that makes sense.  They only ship the one that is compatible with the EXE (or whatever).  Certainly a release (not debug) version and either single or multi-threaded.

>>I can see that you need different versions of LIBs - ok I accept that
>>but why a debug DLL for example. Isnt the dll self contained and
>>has its own library copies?
The problem is the run-time libraries.  There are several versions.  And while they have the vast majority of functions in common, there are small differences.  i.e the debug ones have extra functions like _CrtSetDbgFlg() that are not in the release ones.  The multithreaded ones hav extra fuctions like _beginthread that are not in the single-thread ones.  thus you will tend to get linker errors.  If you can get past them, you will probably just end up with run-time errors instead because there are underlieing differences.

>>May be that's what you mean bt "technically
>>with some care you might be able to"
A dll that doesn't link to the run-time library shouldn't have these issues.  In addition it is probably possible to produce a DLL that does use the run-time library that doesn't have these problems, but it would be restricted to using only a portion of the library and there would be other restrictions as well.  Certainly not worth it.
0
 

Author Comment

by:chrishart
Comment Utility
Thanks for taking the time to expand.

That clears it all up :-)

Cheers chris.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now