Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Parallel port programming in c++ in visual studio 2010

Status
Not open for further replies.

Sumesh Punshi

Newbie level 3
Joined
Aug 18, 2012
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,311
Hi,
I am trying to access the parallel ports through visual studio 2010 using c++ om win XP.
I have included the inpout32.dll in my system directory. I am using this code.

//InpoutTest.cpp : Defines the entry point for the console application.


#include "stdafx.h"
#include "stdio.h"
#include "string.h"
#include "stdlib.h"

//* ----Prototypes of Inp and Outp--- */

short _stdcall Inp32(short PortAddress);
void _stdcall Out32(short PortAddress, short data);
//
//*--------------------------------*/

int main(int argc, char* argv[])
{

int data;

if(argc<3)
{
printf("Error : too few arguments\n\n***** Usage *****\n\nInpoutTest read <ADDRESS> \nor \nInpoutTest write <ADDRESS> <DATA>\n\n\n\n\n");
}
else if(!strcmp(argv[1],"read"))
{

data = Inp32(atoi(argv[2]));

printf("Data read from address %s is %d \n\n\n\n",argv[2],data);

}
else if(!strcmp(argv[1],"write"))
{
if(argc<4)
{
printf("Error in arguments supplied");
printf("\n***** Usage *****\n\nInpoutTest read <ADDRESS> \nor \nInpoutTest write <ADDRESS> <DATA>\n\n\n\n\n");
}
else
{
Out32(atoi(argv[2]),atoi(argv[3]));
printf("data written to %s\n\n\n",argv[2]);
}
}



return 0;
}
But every time i run it...it give an error "Unresolved externals."
 

I got thaT code form logix4u.net

- - - Updated - - -

I got thaT code form logix4u.net

- - - Updated - - -

I got thaT code form logix4u.net
 

Read the Visual Studio or other windows related documentation how to import DLL functions.
 

you got to access it by using system.io.ports or something
I suppose that inpout32.dll does something similar.

The reported problem is about link failure, not failure in operation.
 

the thing is that Microsoft is cutting back on our side of development and making us write more and more code for simple application like these. serial port has not changed for standard components but parallel was not there from the beginning . some time ago it was as simple as outport(0x38) for parallel port access .
 

inpout32.dll should be in the same folder of your test exe.
 

inpout32.dll should be in the same folder of your test exe.
Or in the system folder. But missing dll gives a run time error, while "unresolved external" is a compile/link time problem, caused by missing import library respectively import declaration.
 

since he said ,
"But every time i run it...it give an error "Unresolved externals.""

the running status error may be due to dll .
but as you said unresolved symbols are link time errors.

he can clarify whether the error is due to compiling or running .
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top