-----Message d'origine----- De : gpc-owner@gnu.de [mailto:gpc-owner@gnu.de] De la part de Frank Heckenbach Envoyé : March 15, 2006 13:09 À : gpc@gnu.de Objet : Re: RE : export vs static
<snip>
A separate copy per module is quite different from ex-/importing a variable. If that's what you want, you have to declare the variable in each module in GPC (possibly using an include file). No amount of trickery with ex-/import will get you this.
I understand that.
Or don't you ever change the variable (so it doesn't matter whether or not they are identical)? In this case, `static int' (or better `static const int') might be suitable in C, but in Pascal, you'd better declare a constant (`const A = 4;') which can be ex-/imported, and there are no questions about static or not.
You have a good point there. Since the header files converted into interface section prevented the programs from linking because static variables could not be exported I missed the main aspect of the problem. The original header files contained all things to be visible outside of their corresponding module. In fact, the original code was somewhat wrong. The goal was to have one copy of the variable, shared by many modules, with an initial value with a possibility to change its value. I am not sure if it was possible with SUN Pascal except by using global variables initialized at the beginning of each program. Anyway now most of the programs work (as prototypes) with gpc.
Also with SUN Pascal all symbols are exported by default (again like in C).
No. In C, nothing is exported by default. You have to put each declaration into a header file yourself.
My terminology is not very good I think :-( By exported I meant a symbol can be seen from the outside of its module simply by declaring it "extern". This is not possible with gpc, isn't it? <snip>
Don't know about Sun Pascal, but so far it seems similar to C.
You are right. I missed the point.
Pascal Viandier