Solved

Problem generating libraries

Posted on 1998-12-08
5
904 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
[X]
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
5 Comments
 
LVL 22

Accepted Solution

by:
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).
0
 
LVL 22

Expert Comment

by:nietod
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.
0
 

Author Comment

by:chrishart
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.

Chris
0
 
LVL 22

Expert Comment

by:nietod
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.
0
 

Author Comment

by:chrishart
ID: 1179620
Thanks for taking the time to expand.

That clears it all up :-)

Cheers chris.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Getting IP address 8 121
Android development question 2 108
How do i run a c++ file? 15 57
print bytes of an integer 6 48
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
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. …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

737 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