Hola que tal?
Ahora no tengo un constructor en CProcess, pero si en pila, ya que lo necesito para crearla.
Porque me vuelve a dar este error si esta ya inicializada?
Linking...
Creating library Debug/CProcess.lib and object Debug/CProcess.exp
CProcess.exp : warning LNK4070: /OUT:CProcess.dll directive in .EXP differs from output filename "Debug/CProcess.exe"; ignoring directive
Debug/CProcess.exe : warning LNK4086: entrypoint "_mainCRTStartup" is not __stdcall with 12 bytes of arguments; image may not run
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/CProcess.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
CProcess.exe - 2 error(s), 2 warning(s)
typedef char Tpalabra [20];
class CProcess
{
private:
Tpalabra imageName;
float cpuUsage;
int memUsage;
public:
CProcess();
void pon_imageName(char name[20]);
char* dame_imageName();
void pon_cpuUsage(float cpu);
float dame_cpuUsage();
void pon_memUsage(int mem);
int dame_memUsage();
float valor_inicial_cpu();
int valor_inical_mem();
};
#include "CProcess.h"
#define MAXPILA 5
class CPila
{
private:
CProcess Vector[MAXPILA];
int CimPila;
public:
CPila(void);
int PilaVacia(void);
int PilaLlena(void);
void PushPila(CProcess &c);
CProcess PopPila(void);
};
#include "CProcess.h"
#include <string.h>
void CProcess::pon_imageName(Tpalabra name)
{
strcpy(imageName,name);
}
Tpalabra* CProcess::dame_imageName()
{
return (&imageName);
}
void CProcess::pon_cpuUsage(float cpu)
{
cpuUsage=cpu;
}
float CProcess::dame_cpuUsage()
{
return (cpuUsage);
}
void CProcess::pon_memUsage(int mem)
{
memUsage=mem;
}
int CProcess::dame_memUsage()
{
return (memUsage);
}
#include "pila.h"
CPila::CPila(void)
{
CimPila=-1;
}
int CPila::PilaVacia(void)
{
return(CimPila==-1);
}
int CPila::PilaLlena(void)
{
return(CimPila==MAXPILA-1);
}
void CPila::PushPila(CProcess &p)
{
Vector[++CimPila]=p;
}
CProcess CPila::PopPila(void)
{
return(Vector[CimPila--]);
}
#include "Windows.h"
#include "pila.h"
CProcess my_Process;
CPila mi_pila;
int FAR PASCAL DLLanade_proceso(Tpalabra name, float cpu, int mem)
{
CProcess c;
if (mi_pila.PilaLlena())
return -1;
else {
c.pon_imageName(name);
c.pon_cpuUsage(cpu);
c.pon_memUsage(mem);
mi_pila.PushPila(c);
return 0;
}
}
int FAR PASCAL DLLquita_proceso(Tpalabra name, float* cpu, int* mem)
{
if (mi_pila.PilaVacia())
return -1;
else {
CProcess c = mi_pila.PopPila();
strcpy(name, *c.dame_imageName());
*cpu = c.dame_cpuUsage();
*mem = c.dame_memUsage();
return 0;
}
}
LIBRARY CProcess.dll
DESCRIPTION 'DLL cola de procesos'
HEAPSIZE 1024
EXPORTS
DLLanade_proceso @1
DLLquita_proceso @2