dyerdev
December 12th, 2002, 07:08 AM
Porting problem???
I have a set of defines:
#define PROT_NACK_NONE 0
#define PROT_NACK_BYE 1
…
…
…
#define PROT_NACK_BAD_PROT 3
________________________________
And I also have a typedef structure:
typedef struct reject_s
{
short int rejectCode;
const char *message;
} reject_t;
reject_t *m_rejectTable;
_________________________________
I than implement my function which uses the above:
void CMessageProtocol::setRejectTable( )
{//private:
static reject_t reject[]=
{
{ PROT_NACK_NONE, ""},
{ PROT_NACK_BYE, "Bye"},
{ PROT_NACK_NO_MORE_CON, "No More Connection availiable"},
{ PROT_NACK_BAD_PROT, "Protocol version not supported"},
{ PROT_NACK_BAD_ENC, "Encryption version not supported"},
{ PROT_NACK_BAD_APP, "Application refused"},
{ PROT_NACK_BAD_LOG_PASS, "Invalid Login or password"},
{ PROT_NACK_BAD_MSG, "Invalid Message format"},
{ PROT_NACK_DEFAULT, "Error"},
{ 0, 0}
};
m_rejectTable = reject;
}
The above has been complied and runs under Microsoft Visual Studio 6
I am now attempting to implement this into a .NET library, that has a bunch of __gc classes, when I now attempt to convert using the following syntax:
typedef __nogc struct reject_s
{
const char message;
short int RejectCode;
} reject_t;
reject_t* m_rejectTable;
typedef __nogc struct encrypting_s
{
char crypto;
char * encryptingName;
unsigned char cypher[2];
} encrypting_t;
encrypting_t* m_encryptingTable;
when I attempting to implement the __gc class method that use’s the above:
void GEMBrokerMessengerProtocol::CGEMMessageProtocol::setRejectTable()
{
static reject_t reject[]=
{
{ PROT_NACK_NONE, ""},
{ PROT_NACK_BYE, "Bye"},
{ PROT_NACK_NO_MORE_CON, "No More Connection availiable"},
{ PROT_NACK_BAD_PROT, "Protocol version not supported"},
{ PROT_NACK_BAD_ENC, "Encryption version not supported"},
{ PROT_NACK_BAD_APP, "Application refused"},
{ PROT_NACK_BAD_LOG_PASS, "Invalid Login or password"},
{ PROT_NACK_BAD_MSG, "Invalid Message format"},
{ PROT_NACK_DEFAULT, "Error"},
{ 0, 0}
};
m_rejectTable = reject;
}
I get the following error under Visual Studio C++.NET
c:\Documents and Settings\mdyer\My Documents\Visual Studio Projects\CGEMBroker\GEMBrokerMessengerProtocol.cpp(22): error C2440: 'initializing' : cannot convert from 'int' to 'GEMBrokerMessengerProtocol::CGEMMessageProtocol::reject_t'
c:\Documents and Settings\mdyer\My Documents\Visual Studio Projects\CGEMBroker\GEMBrokerMessengerProtocol.cpp(22): error C2689: Initializing 'reject' : this form of non-aggregate initialization requires a unary constructor
I am very curious as to why I am having these compile errors under .NET and not under my previous compile of Visual Studio 6???? Very lost here????
I have a set of defines:
#define PROT_NACK_NONE 0
#define PROT_NACK_BYE 1
…
…
…
#define PROT_NACK_BAD_PROT 3
________________________________
And I also have a typedef structure:
typedef struct reject_s
{
short int rejectCode;
const char *message;
} reject_t;
reject_t *m_rejectTable;
_________________________________
I than implement my function which uses the above:
void CMessageProtocol::setRejectTable( )
{//private:
static reject_t reject[]=
{
{ PROT_NACK_NONE, ""},
{ PROT_NACK_BYE, "Bye"},
{ PROT_NACK_NO_MORE_CON, "No More Connection availiable"},
{ PROT_NACK_BAD_PROT, "Protocol version not supported"},
{ PROT_NACK_BAD_ENC, "Encryption version not supported"},
{ PROT_NACK_BAD_APP, "Application refused"},
{ PROT_NACK_BAD_LOG_PASS, "Invalid Login or password"},
{ PROT_NACK_BAD_MSG, "Invalid Message format"},
{ PROT_NACK_DEFAULT, "Error"},
{ 0, 0}
};
m_rejectTable = reject;
}
The above has been complied and runs under Microsoft Visual Studio 6
I am now attempting to implement this into a .NET library, that has a bunch of __gc classes, when I now attempt to convert using the following syntax:
typedef __nogc struct reject_s
{
const char message;
short int RejectCode;
} reject_t;
reject_t* m_rejectTable;
typedef __nogc struct encrypting_s
{
char crypto;
char * encryptingName;
unsigned char cypher[2];
} encrypting_t;
encrypting_t* m_encryptingTable;
when I attempting to implement the __gc class method that use’s the above:
void GEMBrokerMessengerProtocol::CGEMMessageProtocol::setRejectTable()
{
static reject_t reject[]=
{
{ PROT_NACK_NONE, ""},
{ PROT_NACK_BYE, "Bye"},
{ PROT_NACK_NO_MORE_CON, "No More Connection availiable"},
{ PROT_NACK_BAD_PROT, "Protocol version not supported"},
{ PROT_NACK_BAD_ENC, "Encryption version not supported"},
{ PROT_NACK_BAD_APP, "Application refused"},
{ PROT_NACK_BAD_LOG_PASS, "Invalid Login or password"},
{ PROT_NACK_BAD_MSG, "Invalid Message format"},
{ PROT_NACK_DEFAULT, "Error"},
{ 0, 0}
};
m_rejectTable = reject;
}
I get the following error under Visual Studio C++.NET
c:\Documents and Settings\mdyer\My Documents\Visual Studio Projects\CGEMBroker\GEMBrokerMessengerProtocol.cpp(22): error C2440: 'initializing' : cannot convert from 'int' to 'GEMBrokerMessengerProtocol::CGEMMessageProtocol::reject_t'
c:\Documents and Settings\mdyer\My Documents\Visual Studio Projects\CGEMBroker\GEMBrokerMessengerProtocol.cpp(22): error C2689: Initializing 'reject' : this form of non-aggregate initialization requires a unary constructor
I am very curious as to why I am having these compile errors under .NET and not under my previous compile of Visual Studio 6???? Very lost here????