Problem generating libraries

Posted on 1998-12-08
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.

Question by:chrishart
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 22

Accepted Solution

nietod earned 200 total points
ID: 1179616
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).
LVL 22

Expert Comment

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

Author Comment

ID: 1179618
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.

LVL 22

Expert Comment

ID: 1179619
>> 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.

Author Comment

ID: 1179620
Thanks for taking the time to expand.

That clears it all up :-)

Cheers chris.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

690 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