Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to add an external library that I downloaded from the internet to a vb .net winform project. I can find the file when I browse for the reference in myComputer, when I click OK I get an error saying that the reference 'could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component.' Can anyone tell me what am I doing wrong?
Posted
Updated 28-Jul-14 5:11am
v2

1 solution

The library you downloaded is not COM-based or a >NET library. It's a standard C-type library with only functions in it.

You cannot add a reference to it.

You can, however, call the functions in that library using P/Invoke. This requires that you know the exact names of the functions and the exact list of parameters each of those functions expects. There is no tool that will tell you these things. You MUST Have the documentation on the library in order to use it.

P/Invoke[^]
 
Share this answer
 
Comments
Member 10804519 28-Jul-14 11:36am    
So what you're saying is that unless I know the exact names of the functions in the library then this library is useless?
Dave Kreskowiak 28-Jul-14 12:19pm    
Yep. You MUST have the documentation on it in order to use it.
Sergey Alexandrovich Kryukov 28-Jul-14 12:35pm    
Indeed, one would need documentation. However, your answer is not exactly accurate. The names of the exported functions can be easily found. Any binary dump tools will do it. Moreover, if the function names are decorated in standard way and the parameters are primitive, the signature can be figured out. However, does it worth doing? Hardly. Generally, this information still does not allow to understand how to use the library.
—SA
Dave Kreskowiak 28-Jul-14 13:12pm    
Yeah, DependencyViewer will show you the function names, but there is no tool to give you the parameters list.

The parameters list can be figured out by examing the code in the library for how it's values are popped off the stack. If YOU want to walk him through that, be my guest. I don't have a months worth of time to do it.

:)
Sergey Alexandrovich Kryukov 28-Jul-14 13:25pm    
Sure, who would argue against that? But I wanted to clarify that "exact names of functions" is actually known.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900