Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LNK2001: unresolved external symbol _outp????

Status
Not open for further replies.

snt

MIS
Jun 19, 2000
104
0
0
US
SWdll.obj : error LNK2001: unresolved external symbol _outp
SWdll.obj : error LNK2001: unresolved external symbol _inp
Debug/SWdll.dll : fatal error LNK1120: 2 unresolved externals

I do not understand this. Why would it be looking at outp and inp as symbols? Aren't these standard c calls?
Here is the code:
Code:
// SWdll.cpp : Defines the entry point for the DLL application.
//

#include "stdafx.h"
#include "SWdll.h"
#include "Conio.h"
#include "time.h"

#define Dlltest 8

#define Strobe 8
#define Nullreg 4
#define True 1

#define False 0
#define Sidetectors  512
#define PbSdetectors 192
#define PbS1 128
#define PbS2 64
#define Simax 28000

/*Global Variables */
unsigned int regstat=0;


/* Commands */
/* REGADDR 0 */
unsigned int 	sgo = 0x0001,
				pstart = 0x0002,
				openshut = 0x0008,
				closeshut = 0x0020,

/* REGADDR 1 */
				wrdf = 0x0101,

/* REGADDR 5 */
				Si_ADC = 0x0500,  /* Muxval | = 1,2,4 */
				bufen = 0x0540,

/* REGADDR 6 */
				scanreset= 0x0600,
				pbsmuxreset = 0x0601,
				siscan= 0x0602,
				pbsscan= 0x0604,

				sintsp=0x0600,  /* | = 16,32,64 */

/* REGADDR 7 */
				rsi = 0x0701,
				rstsi = 0x0702,
				rtsi = 0x0704,
				rtpbs = 0x0708,
				rstpbs = 0x0710,
				rpbs = 0x0720,
				rsdf = 0x0740,

/* Flags */
sifull = 8,
sihfull = 4,
siempty = 2,
pbsempty = 1;

int
Active = 1,
Inactive = 0;

unsigned long int  sodelay = 50000, pbsdelay = 6000, sidelay = 3000;
unsigned int asmdelay = 30,Port1 = 888, Iport2 = 889, Port0 = 890;

/*Internal Prototypes */
int Autoscale(void);
void Delay(unsigned long int wait);
int Calcdelay(void);
void Latchout(unsigned int command);
void Pulseout(unsigned int command, int pulses);
int Pollflag(int flagval,int level, int prevcommand);
void Rsystem(void);
int ScanSi(int muxval, int siintsp, int Si_avg, int reads, long int far *Sidata);

/* Assembly Routine Prototypes */
void Readfifo(int pulses, long int far *fifodata);
void Readpbsfifo(int integration_loops, long int far *pbsfifodata);


BOOL APIENTRY DllMain( HANDLE hModule, 
                       DWORD  ul_reason_for_call, 
                       LPVOID lpReserved
					 )
{
    switch (ul_reason_for_call)
	{
		case DLL_PROCESS_ATTACH:
		case DLL_THREAD_ATTACH:
		case DLL_THREAD_DETACH:
		case DLL_PROCESS_DETACH:
			break;
    }
    return TRUE;
}


SWDLL_API int Batval(int muxval, float *BatteryReading)
{
int i;
unsigned int pass;
long int Batdata[Sidetectors];

Rsystem();
for(i=0; i<Sidetectors; i++)
Batdata[i] = 0;

if(ScanSi(muxval, 0, 1, Sidetectors, &Batdata[0]) == 0)
return(0);

pass = Batdata[10];
*BatteryReading = (float)Batdata[10]/32768*20;

return(pass);
}


int ScanSi(int muxval, int siintsp, int Si_avg, int reads, long int far *Sidata)
{
	int i, pass;
	unsigned int pollvalue;

/*Scan Si */
    /*Set Si Integration Speed*/
   	Latchout(Si_ADC | muxval);
   	Latchout(scanreset | (siintsp << 4));

	for(i=0; i<Si_avg; i++)
	{
        Delay(sidelay);   /**(siintsp + 1)*/
		Latchout(scanreset | (siintsp << 4));
		/* Reset Fifo's */
		Pulseout(rstsi , 1);

		/* Start Si Scan */
		Latchout(siscan | (siintsp << 4));

	    /* poll si fifo full flag */
	    if(Pollflag(sifull,Active,Si_ADC | muxval) == 0)
	    	return(0);

	   	/* reset scan timing */
		Pulseout(scanreset | (siintsp << 4),1);

		/* read Si fifo*/
		/*Readfifo(reads,Sidata);*/
	}

    return (1);
}

/*Internal Subroutines*/




void Latchout(unsigned int command)
{
	unsigned int address,value;

	address = (command >> 8) | regstat;
	value = command & 0xFF;
    outp(Port0,address);
    outp(Port1,value);

    outp(Port0,address ^ Strobe);
    outp(Port0,address ^ Strobe);
    regstat ^= Strobe;
    outp(Port1,0);


}

void Pulseout(unsigned int command, int pulses)
{
    int i;

	outp(Port0,Nullreg);
    regstat = 0;
	outp(Port1,command & 0xFF);
    for(i=0; i<pulses; i++)
    {
		outp(Port0,(command >> 8) | regstat ^ Strobe);
		outp(Port0,(command >> 8) | regstat ^ Strobe);
		regstat ^= Strobe;
    }
	outp(Port0,Nullreg | regstat);
	outp(Port1,0);

}

int Pollflag(int flagval,int level,int prevcommand)
{
	int sistat;
	time_t starttime,testtime;

    time(&starttime);

	/* set bufen */
 	Latchout(prevcommand | bufen);

	/* get sififo status */
    outp(Port0,2 | regstat);
    if (level == Active)
    {
	    do
	    {
		sistat = (inp(Iport2)) >> 4;
		sistat &= flagval;
		time(&testtime);
		if(difftime(testtime,starttime)>5)  /* 5 second time out */
			return(0);
	    }
	    while (sistat != flagval);
    }

    else if (level == Inactive)
    {
	    do
	    {
		sistat = (inp(Iport2)) >> 4;
		sistat &= flagval;
		time(&testtime);
		if(difftime(testtime,starttime)>10)
			return(0);
	    }
	    while (sistat == flagval);

    }
	outp(Port0,0 | regstat);

	/* reset bufen */
	Latchout(prevcommand);

    return (1);

}

void Rsystem(void)
{

    outp(Port0,Nullreg | regstat);

   	/* Reset scanning */
	Pulseout(scanreset, 1);

	/* RESET FIFO's */
	Pulseout(rstsi | rstpbs, 1);

	/* Close Shutter */
	Pulseout(closeshut, 1);

}

void Delay(unsigned long int wait)
{
	unsigned long int i;
	int j;

	for (j=0; j<10;j++)
	{
	for (i=0; i< wait; i++)
	{}
	}
}

I did not write this. I am trying to re-write for 32-bit and I don't know a damn thing about C/C++. Any help is greatly appreciated.

SNT


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top