Just to clear some things up and to show I look like an idea...
My host file probeblem was caused by...
1. Having all 3 of the files (dll.h, dll.cpp, mainfile.cpp) in the same project file.
2. If I didnt' do 1. then I still have all 3 files open at the same time.
Oh and YES it DID WORK!!!!
It only took...
lol, good stuff..
Well at least now, there is a reference thread to anyone who's making a dll.
lol really big one... LOL
Ok sorry btu I got anoutehr probelem...
In this code...
This is the mainfile.cpp...
In the part...
// Function Pointer
// Load DLL
HMODULE hMod = LoadLibrary("wordset1.dll");
// Assign the function pointer to the
// address of the function in the dll
TextFunc = (void(*)())GetProcAddress(hMod, "test");
// If it found it
I don't want a just text. I want it so I can have variables declared and everything else.
How do I do that?
Never mind! It all works just a silly mistake again...
Here you go:
void (*psomefn)() = somefn;
int (*psomefn)() = somefn;
int somefn(char*, int);
int(*psomefn)(char*, int) = somefn;
Yeah, a function pointer will work about the same way as a normal function (You can pass arguments through them).
With out creating an object, (class or struct) Im not sure if you could point to variables in that same way. But you can definately use functions to return certain values like bithub stated.
ok thanks I shoudl be able to the rest now...
THANKS SO MUCH!!!!
(gives thread a 5* rating) Maybe a mod delete some useless posts, change the title and move to FAQ board?