xsub and gcc 4.0.2, static variables

  • Thread starter thorsten kracht
  • Start date
T

thorsten kracht

Dear All,
I have a problem with static variables (file scope static
variables), if I call my C code from Perl via XSUB.
This problem does not arise with the gcc 3.3 compiler
on a 2.4.20 system (and all versions before). I occurs
with gcc 4.0.2 under 2.6.13.

The static variables change their addresses (and also their
values) in these cases:

1. I run my C code and reach the print statement from
C alone.

2. I run my C code, then call Perl and from Perl I call
my C code again.


Has anybodey else seen this behavious and mayby give me
some help? Compiler switch or some keyword in C.
For me it would be a hufe task to change my static variables
to glogal variables.

Thanks for reading my message and best regards, Thorsten
 
A

Anno Siegel

thorsten kracht said:
Dear All,
I have a problem with static variables (file scope static
variables), if I call my C code from Perl via XSUB.
This problem does not arise with the gcc 3.3 compiler
on a 2.4.20 system (and all versions before). I occurs
with gcc 4.0.2 under 2.6.13.

The static variables change their addresses (and also their
values) in these cases:

1. I run my C code and reach the print statement from
C alone.

Do you say "print" for a reason? Perl has a "print" statement,
C only has printf.
2. I run my C code, then call Perl and from Perl I call
my C code again.

Has anybodey else seen this behavious and mayby give me
some help? Compiler switch or some keyword in C.
For me it would be a hufe task to change my static variables
to glogal variables.

Could you reduce the problem to a minimal case that you can post and
we can run?

Anno
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top