Parallel Port Controlling by inpout32.dll
Hello ,
I have 2 alternative codes for the aim I have stated in my topic.
First one is :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
#include <windows.h>
#include <iostream>
#define Data 0x378
using namespace std;
int main(int argc, char *argv[])
{
HINSTANCE oz;
oz=LoadLibrary("inpout32.dll");
void _stdcall Out32(short a,short b);
Out32(Data,254);
system("PAUSE");
return EXIT_SUCCESS;
}
|
With this my compiler gives the error :
[Linker error] undefined reference to `_Z5Out32ss@8'
The second one is :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
#include <windows.h>
#include <iostream>
#define Data 0x378
using namespace std;
int main(int argc, char *argv[])
{
HINSTANCE oz;
oz=LoadLibrary("inpout32.dll");
typedef int (_stdcall function)(char *a,int b);
function *func;
func=GetProcAddress(oz,"Out32");
func(Data,254);
system("PAUSE");
return EXIT_SUCCESS;
|
And this one gives :
"12 C:\Dev-Cpp\main.cpp invalid conversion from `int (*)()' to `int (*)(char*, int)' "
I am really tired of the problems about this matter .Could you help me out ?
void __stdcall *Out32(short a, short b) = GetProcAddress(oz, "Out32"); //Or whatever signature you need; you show 2 different ones.
I'm no expert with function pointers, but I think this is how it is done. Check out
http://www.newty.de/fpt/index.html .
Topic archived. No new replies allowed.