[fpc-pascal]Exporting vars
Michael.VanCanneyt at Wisa.be
Michael.VanCanneyt at Wisa.be
Fri Aug 24 11:12:19 CEST 2001
On Fri, 24 Aug 2001, Mauricio Stefani wrote:
> Hello :-)
>
> Please, have anybody ever tryed to export variables to a source in C?
> I couldn't get it to work with the cvar modifier... The compiler shows me an
> error message:
>
> test : integer; cvar;
>
> Error line ... : expecting : found ;
>
> Is that right? Please, what's the mistake?
This is not right; You are probably using {$mode tp} or the -So switch;
this causes that error to appear (cvars are not allowed in -So mode)
The following compiles fine with no mode set:
unit testv;
Interface
Var
c : Pchar; cvar;
Implementation
begin
C:='Some string';
end.
and it links perfectly with
#include <stdio.h>
extern char * c;
int main () {
printf("%s",c);
return 0;
}
The output is (null), since the initialization section was not called from
the C program, so this is normal.
Michael.
More information about the fpc-pascal
mailing list