Solved

Problem generating libraries

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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Grammars for C C++ and java 1 122
I could not build boost code, 10 88
Path to  STL Map header file 1 58
gdb doesn't stop on breakpoint 2 68
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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 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.

803 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