|
-
July 5th, 2010, 04:39 PM
#1
[RESOLVED] Problem with adding DLL/lib file into VC++ Project
Hi,
I am developing a VC++ MFC SDI Project. I have to use a bunch of functions from a dll/lib which is provided by the hardware provider (I have to use an external usb hardware).
In the source code provided I have a dll file, a lib file, and a folder with a bunch of include (.h ) files.
I first added the dll and lib in the project folder. I added the lib file in the project. and used
extern "C" __declspec(dllimport)
to get the functions in my project, but it did not help. The project compiles properly, but apparently the functions don't do the tricks that they are supposed to do.
Then I added and included the header files provided, and had to remove the dllimport (since it gave error 'overloaded functions' (the header files had declaration of functions). It compiled well, but still the functions don't do the trick.
I don't know what the problem is. It does not give any errors, but the functions don't do what they are supposed to do, when they are called.
I would be really glad if someone could help.
-
July 6th, 2010, 03:07 AM
#2
Re: Problem with adding DLL/lib file into VC++ Project
 Originally Posted by guptesanket
I don't know what the problem is. It does not give any errors, but the functions don't do what they are supposed to do, when they are called.
I would be really glad if someone could help.
WEll, there may be at least two reasons when "the functions don't do what they are supposed to do":- the functions were developed/implemented not 100% correctly
- you are using those functions not 100% correctly
Victor Nijegorodov
-
July 6th, 2010, 10:31 AM
#3
Re: Problem with adding DLL/lib file into VC++ Project
The dll/lib was provided by the hardware vendor, so there is no way that the functions would be defined incorrectly.
I used the functions exactly as they had used it in their source code, i don't think there is any incorrect syntax.
I think there is some mistake that i did during the connection. Could you just briefly tell me, what are the steps involved for including a dll. The following are the things that I have:
1 dll file
1 lib file
5 header files.
I would be really glad if someone could help me, I cannot move ahead in my work without resolving this issue.
-
July 6th, 2010, 10:41 AM
#4
Re: Problem with adding DLL/lib file into VC++ Project
 Originally Posted by guptesanket
... I would be really glad if someone could help me, I cannot move ahead in my work without resolving this issue.
But you didn't provide any useful info about this "issue" except:
 Originally Posted by guptesanket
... I don't know what the problem is. It does not give any errors, but the functions don't do what they are supposed to do, when they are called.
I would be really glad if someone could help.
Please, define "don't do what they are supposed to do"
Victor Nijegorodov
-
July 6th, 2010, 10:43 AM
#5
Re: Problem with adding DLL/lib file into VC++ Project
Include the header files in the CPP file that uses the API. Link with the lib (add it to your project properties in Linker option: "Input" "Additional Dependencies". Just make sure the dll is in the same directory as the EXE or somewhere in the PATH.
That should be it.
-
July 6th, 2010, 10:51 AM
#6
Re: Problem with adding DLL/lib file into VC++ Project
Ok I will elaborate. I have to use a Dynamometer to get input into my program.
The hardware vendor have provided me a bunch of files. 1 dll file, 1 lib file, and a few header files. In addition to that there is a source code for a program using all the .h and .cpp files which are actually included into the .dll file. Since the source code is in VC++ 6.0 is does not run in VC++9.0. It gives hundreds of errors.
In a document provided by them, they say that to use the hardware in your own program you need to use the provided dll/lib. Files
I have done all the things as mentioned in my first post. But it does not help.
The functions help in establishing a connection with the hardware. Then collect input in a buffer. But first of all, one of the functions gives a list of all the hardware compatible with that vendor. Currently I get nothing in the list. Leave aside the input in buffer etc.
I have an exe of the program provided by the vendor, which works very well. So there is definitely no problem with the Hardware (Dynamometer).
If it is of any help, (if someone as already used it before) the hardware vendor is 'Vernier' and the files that I have to use are 'GoIO_DLL.dll' 'GoIO_DLL.lib' and other bunch of include files.
Thank you very much in advance.
Last edited by guptesanket; July 6th, 2010 at 10:58 AM.
-
July 6th, 2010, 10:57 AM
#7
Re: Problem with adding DLL/lib file into VC++ Project
Again: could you be so kind to define "don't do what they are supposed to do" ?
Victor Nijegorodov
-
July 6th, 2010, 11:06 AM
#8
Re: Problem with adding DLL/lib file into VC++ Project
I am sorry edited the last post and wrote the details. I do not know if it is of any help. But here it is.. again
As of now, the functions that I have used are for,
Getting a list of 'Vernier' hardware.
Establishing a connection to one of the selected hardware from the list.
Start getting input from the selected hardware.
Store the input in a buffer.
Stop input from the hardware.
-
July 6th, 2010, 11:11 AM
#9
Re: Problem with adding DLL/lib file into VC++ Project
Well, this is my last attempt to understand what your problems are:
what do you mean by "don't do what they are supposed to do" ?
Victor Nijegorodov
-
July 6th, 2010, 11:12 AM
#10
Re: Problem with adding DLL/lib file into VC++ Project
 Originally Posted by hoxsiew
Include the header files in the CPP file that uses the API. Link with the lib (add it to your project properties in Linker option: "Input" "Additional Dependencies". Just make sure the dll is in the same directory as the EXE or somewhere in the PATH.
That should be it.
I am sorry, but i am a bit new to VC++ programming. I have the dll and lib in the program folder. and I have added the lib into the project. But as you mentioned, there is nothing in 'Additional Dependencies'. That field is blank. Could you please tell me what to do in that. When I go in 'Additional Dependencies' it gives a blank text area. What am I supposed to write in there?
Thank you very much.
-
July 6th, 2010, 11:16 AM
#11
Re: Problem with adding DLL/lib file into VC++ Project
Dear guptesanket!
Don't you understand what I ask? 
Or my English is so bad that you couldn't understand it? Then could you suggest some other language that you'd understand better?
Victor Nijegorodov
-
July 6th, 2010, 11:17 AM
#12
Re: Problem with adding DLL/lib file into VC++ Project
I am sorry Mr. VictorN. But i already edited the earlier post and mentioned, that I do not get anything in the list, by the function which is supposed to give me the name of the hardware in the list. And hence it does not move ahead in any other functions. and the tasks of the other functions are as mentioned in my earlier posts.
Thank you
-
July 6th, 2010, 11:23 AM
#13
Re: Problem with adding DLL/lib file into VC++ Project
Victor Nijegorodov
-
July 6th, 2010, 11:37 AM
#14
Re: Problem with adding DLL/lib file into VC++ Project
1.Yes i have added the include files.
2. ---- I did not understand that---
3.-- I have not done that--.. how do I do that>?
4. Yes, my project compiles
5. Yes, my project links.
6. There are no errors.
It actually executes well.
There is a 'Devices' menu in my project. When I click on the 'Devices', it should give a menu, with a list of all 'plugged in' (Vernier Company) devices. In the menu, I have named 7 devices. If that device is not attached, then, that name in the menu is removed. So, currently i have nothing in the 'Devices' menu.
I would be glad, if you could tell me about point 2 and 3 above.
Thank you.
-
July 6th, 2010, 11:45 AM
#15
Re: Problem with adding DLL/lib file into VC++ Project
 Originally Posted by guptesanket
1.Yes i have added the include files.
2. ---- I did not understand that---
Do you call some of the functions exported from a dll of 'Vernier' hardware? Yes or no?
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|