salut a tous donc voila mon probleme, j'ai fait une classe et ensuite j'ai voulu la mettre en dll mais lorsque je compile cette erreur la s'affiche quelqu'un pourrait-il m'aider ?
c:\Documents and Settings\anthonycosson\Mes documents\Visual Studio Projects\controle_lecteur\controle_lecteur.h(23): error C2697: 'port' : must explicitly specify __gc or __nogc for an array declared in a managed type
voila le code si ca pe aider ;
namespace
controle_lecteur
{
public __gc class lecteur_controle
{
// TODO: Add your methods for this class here.
private:
COMMTIMEOUTS Timeout;
int
parite;
int
bitstop;
HANDLE h_com;
DCB ladcb;
char
port[5];<=================l'erreur se touve ici !!!!!!!<=================
private
:
//envoi ok//
int
envoi(unsigned char* command)
{
DWORD nboce;
int retour;
retour=WriteFile(
this->h_com,command,11,&nboce,NULL);
if((retour==0) || (nboce<=0))
{
return 0;
}
char* bc=(char*)malloc(100);
return this->reponse_lecteur(bc);
}
//param ok//
int
param()
{
int
debit;
int
tab[8];
tab[0]=300;
tab[1]=600;
tab[2]=1200;
tab[3]=2400;
tab[4]=4800;
tab[5]=9600;
tab[6]=19200;
tab[7]=38400;
int
tab1[9][2];
tab1[0][0]=1;
tab1[0][1]=2;
tab1[1][0]=1;
tab1[1][1]=0;
tab1[2][0]=1;
tab1[2][1]=1;
tab1[3][0]=1;
tab1[3][1]=3;
tab1[4][0]=1;
tab1[4][1]=4;
tab1[5][0]=2;
tab1[5][1]=2;
tab1[6][0]=2;
tab1[6][1]=0;
tab1[7][0]=2;
tab1[7][1]=1;
tab1[8][0]=2;
tab1[8][1]=3;
for
(int i=0;i<8;i++)
{
debit=tab[i];
for(int y=0;y<9;y++)
{
parite=tab1[y][1];
bitstop=tab1[y][0];
if
(!GetCommState(h_com,&ladcb))
{
CloseHandle(h_com);
return 0;
}
if
(debit==300)
ladcb.BaudRate=CBR_300;
if
(debit==600)
ladcb.BaudRate=CBR_600;
if
(debit==1200)
ladcb.BaudRate=CBR_1200;
if
(debit==2400)
ladcb.BaudRate=CBR_2400;
if
(debit==4800)
ladcb.BaudRate=CBR_4800;
if
(debit==9600)
ladcb.BaudRate=CBR_9600;
if
(debit==19200)
ladcb.BaudRate=CBR_19200;
if
(debit==38400)
ladcb.BaudRate=CBR_38400;
if
(parite==0)
ladcb.Parity=NOPARITY;
if
(parite==2)
ladcb.Parity=EVENPARITY;
if
(parite==1)
ladcb.Parity=ODDPARITY;
if
(parite==3)
ladcb.Parity=MARKPARITY;
if
(parite==4)
ladcb.Parity=SPACEPARITY;
if
(bitstop==1)
ladcb.StopBits=ONESTOPBIT;
if
(bitstop==3)
ladcb.StopBits=ONE5STOPBITS;
if
(bitstop==2)
ladcb.StopBits=TWOSTOPBITS;
if(!SetCommState(h_com,&ladcb))
{
CloseHandle(h_com);
return 0;
}
Timeout.ReadTotalTimeoutConstant=500;
if
(!SetCommTimeouts(h_com,&Timeout))
{
CloseHandle(h_com);
return 0;
}
unsigned char command[11];
command[0]=0x16;
command[1]=0x4D;
command[2]=0x0D;
command[3]=0x32;
command[4]=0x33;
command[5]=0x32;
command[6]=0x42;
command[7]=0x41;
command[8]=0x44;
command[9]=0x3F;
command[10]=0x2E;
if(this->envoi(command)!=0)
{
return 1;
}
}
}
return
0;
}
//recherche ok//
int
recherche()
{
h_com=CreateFile(port,GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL);
if
(h_com == INVALID_HANDLE_VALUE)
{
CloseHandle(h_com);
return 0;
}
return
this->param();
}
public:
lecteur_controle(){}
//connection ok//
int
connection()
{
unsigned char tab[5]={0x31,0x32,0x33,0x34};
for(int i=0;i<5;i++)
{
port[0]='C';
port[1]='O';
port[2]='M';
port[3]=tab[i];
port[4]='\0';
if(this->recherche()!=0)
{
return 1;