From: Adrian on
I have the following header structures:

typedef struct tagSTR1
{
float fA;
float fB;
}
STR1, *PSTR1;

typedef struct tagSTR2
{
int a;
int b;
int c;
int d[25];
}
STR2, *PSTR2;

typedef struct tagSTR3
{
int A;
int B;
float C;

int D;
int E;
int F;
int G;

STR1 H;

int J;
int K;
STR2 L;

int M;

int N[4];
}STR3, *PSTR3;

When i pass a PSTR3 to a function from C with calllib the value from J is shifted to K. While value fA from STR1 is shifted to fB. fA=0.
From: Adrian on
CORRECTION: STR1 is defined in a separate header.
I get also an error when construct myself all the structure: "It is not possible to assign a value to an externally defined structure."
From: Adrian on
"Adrian " <adryyandcRemoveThis(a)yahoo.com> wrote in message <hmlno0$45b$1(a)fred.mathworks.com>...
> I have the following header structures:
>
> typedef struct tagSTR1
> {
> float fA;
> float fB;
> }
> STR1, *PSTR1;
>
> typedef struct tagSTR2
> {
> int a;
> int b;
> int c;
> int d[25];
> }
> STR2, *PSTR2;
>
> typedef struct tagSTR3
> {
> int A;
> int B;
> float C;
>
> int D;
> int E;
> int F;
> int G;
>
> STR1 H;
>
> int J;
> int K;
> STR2 L;
>
> int M;
>
> int N[4];
> }STR3, *PSTR3;
>
> When i pass a PSTR3 to a function from C with calllib the value from J is shifted to K. While value fA from STR1 is shifted to fB. fA=0.

I have found the solution. It was an structure alignment problem.
From: Philip Borghesani on

"Adrian " <adryyandcRemoveThis(a)yahoo.com> wrote in message news:hmlock$fo8$1(a)fred.mathworks.com...
> CORRECTION: STR1 is defined in a separate header.
> I get also an error when construct myself all the structure: "It is not possible to assign a value to an externally defined
> structure."
>

If you are using R2009a see this:
http://www.mathworks.com/support/bugreports/537829



From: Adrian on
"Philip Borghesani" <philip_borghesani(a)mathworks.spam> wrote in message <hmm3t4$q3f$1(a)fred.mathworks.com>...
>
> "Adrian " <adryyandcRemoveThis(a)yahoo.com> wrote in message news:hmlock$fo8$1(a)fred.mathworks.com...
> > CORRECTION: STR1 is defined in a separate header.
> > I get also an error when construct myself all the structure: "It is not possible to assign a value to an externally defined
> > structure."
> >
>
> If you are using R2009a see this:
> http://www.mathworks.com/support/bugreports/537829
>
>

Thank You Philip! It is an useful link.