Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating custom .lib 1

Status
Not open for further replies.

jbs

Programmer
Feb 19, 2000
121
US
How do I create a .lib file that has some custom functions? How do I then call these individual functions from my program. I'm familiar with how to link the .lib n my VC++ IDE project environement.

thanks/j
 
>How do I then call these individual functions from my program

By giving the calling application access to the header files of the "exported" (its not relly exported) functions/classes.



/Per
[sub]
"It was a work of art, flawless, sublime. A triumph equaled only by its monumental failure."[/sub]
 
Thanks for your quick response, however if you (or anyone) has a moment my question is really a two part question.

First, how do I create a .lib file with a function in it. A reference (url link) would work fine (i've looked through msdn, etc. but couldn't find a clear example) or an example using a basic function that using the MessageBox API would also work great.

The second part of the question is how do I then call it in an application. I know I have to reference/link the .lib file in....but how do I find the exact file. thanks.../j
 
You can use the AppWizard to generate a static lib project.
Write a function in it as you normally do.

When compiling it generates a lib. Then you'd link to that lib in your calling application.

Project -> Settings... -> Link Object/Library modules.

Note that you can have more than one project in your workspace. In this case it'd perhaps make sense to have both the lib project and the calling project in the same workspace (though you dont HAVE to), mainly because it's convenient to switch between the two. Besides, of you also set the dependecies (Project->Dependencies) so that the calling project depends on the lib, the calling project will be re-compiled if your lib is changed.




/Per
[sub]
"It was a work of art, flawless, sublime. A triumph equaled only by its monumental failure."[/sub]
 
thanks for the terrific explaination! I'll try that today/j
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top