I have a REALLY stoooopid Visual Studio .NET question.

NuclearNed

Raconteur
May 18, 2001
7,882
380
126
I need someone to confirm that I did this correctly.

I need to access a function that I think is found in a 3rd party .LIB file that my company owns. In Visual Studio .NET, first I added the .LIB to my current project, then I went to the properties of my current project, went to the "linker"..."input" section, and entered the name of the .LIB file under "Additional Dependencies". Is this the correct way to do this, or are there things I need to do in addition to this? I keep getting a linker error - the linker is saying that the function is an unresolved external.
 

WannaFly

Platinum Member
Jan 14, 2003
2,811
1
0
functions are typically in .DLL files - I've never heard of them being in a .LIB, which might explain your linker error - theres probably nothing to link :D
 

UCJefe

Senior member
Jan 27, 2000
302
0
0
Is the .lib file in the project directory? If not, you will probably need to add the directory to look in to the Project->Settings->Linker->General->"Additional Library Directories". But yes, the way you are doing it is correct as long as all the files are in the right places. If you're still having problems, post the exact error you are getting.
 

Apathetic

Platinum Member
Dec 23, 2002
2,587
6
81
Originally posted by: WannaFly
functions are typically in .DLL files - I've never heard of them being in a .LIB, which might explain your linker error - theres probably nothing to link :D

A .LIB file is an old style library file (similar to a non ActiveX DLL).

Dave
 

Cerebus451

Golden Member
Nov 30, 2000
1,425
0
76
Originally posted by: WannaFly
functions are typically in .DLL files - I've never heard of them being in a .LIB, which might explain your linker error - theres probably nothing to link :D
Even a DLL has a corresponding .LIB file. The .LIB file contains the export definitions for the functions that are found in the DLL. You can also have a static LIB file that gets linked into your program, with no need for a DLL at run time.

As to the OP, if you added the LIB file to your project, that is all you need to do (though I don't have much experience with .NET, I use version 6). I don't have an "Additional Dependencies" on the Linker->Input project settings window, so I don't know if you need it there or not. As for the unresolved symbol, the problem is most likely the naming convention. Is the lib C, C++, VB? If it is C, is it using stdcall or normal C calling conventions? You have to update the prototype of the function in your code so that the linker knows exactly which mangled name to look for in the LIB file.