Solved

Problem generating libraries

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying 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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
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 goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.

821 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