|
-
Nov 17th, 2000, 11:13 PM
#1
Thread Starter
Lively Member
I know that it may sound stupid, but can anyone give me a generic code to call a dll in C++?
I looked on the web and I only found hot to call them from VB, wich is not a problem for me...
I have a dll and all the documentation, I just need to know how to call it...
shouldn't be too complicated :-)
thanks
-
Nov 18th, 2000, 09:20 AM
#2
Monday Morning Lunatic
Did it come with any headers or libraries? Normally, you'd have the following:
A DLL, a header containing the function prototypes, and a stub library for the linker.
When you use this, the dynamic linking is resolved at compile time. Simply include the header and add the stub library to the list of libraries.
If not, then you can use run-time dynamic linking, which is much more complicated. What you need to do is to use the Win32 API calls LoadLibrary, GetProcAddress, etc. See here for an example of how to use it: http://www.parksie.uklinux.net/addin_fixed.zip
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Nov 22nd, 2000, 11:26 AM
#3
Thread Starter
Lively Member
Ok, I have all the headers, dll and lib.
I added the header to my project, and the lib is in the section "ressource files"
but it just doesn't compile because of an unresolved external symbol.
So it can't find the function in the lib...
what did I forget to do?
thanks
-
Nov 22nd, 2000, 05:48 PM
#4
Monday Morning Lunatic
Oops...I should have been clearer.
Copy the include to your normal includes folder (F:\vstudio\vc\include for me), then use it in your program as any other system include (#include <header.h>).
Copy the library to the lib folder, and go to Project Settings and choose the Link tab. Add the library file to the list you see.
Make sure that the header and library have been removed from the workspace, too.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
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
|