This message was edited by kikijas at 2007-3-26 1:40:11
I have part of my c-codes as below:
//prototype
int Funct1(UL32 * para1, UL32 para2);
typedef unsigned long UL32;
typedef struct STRUCTDEF1
{
unsigned char Data3;
unsigned int Data2;
}STRUCTDEF1;
typedef struct STRUCTDEF2
{
unsigned int Data1;
STRUCTDEF1 DataBuf1;
}STRUCTDEF2, *P_STRUCTDEF2;
void main()
{
STRUCTDEF2 val;
unsigned long val2;
.
.
.
if(Funct1((UL32*)&val, val2))
{
. . .
}
.
.
.
}
int Funct1(UL32 * para1, UL32 para2)
{
..
..
..
}
I am using the open watcom compiler. I need to build this program into a DOS 32-bit executable program. I am facing the problem below:
When I call the Funct1 by passing the parameter as following:
Funct1(&val1, val2)
The compiler gives the error message "Type of parameter 1 does not agree with previous definition". There are 2 notes saying that "Source conversion type is 'struct _STRUCTDEF2 *'" and "target conversion type is 'unsigned long *'".
So I try to cast the "&val" to UL32 when I call the "Funct1()" in the main function, as shown in my codes above.
This does solved the problem, but will it pass the correct parameters to the function "Funct1"?
How can I display the value of the "para1" in Funct1?
Highly appreciated if anyone can help to answer the above questions.