Emil Jerabek wrote:
On Fri, Jun 18, 2004 at 03:54:39PM +0200, Eike Lange wrote:
On Friday 18 June 2004 15:40, Igor Marnat wrote:
But how can I get these values of C preprocessor definitions in my Pascal program?
Please note, that "asmname" is deprecated.
In C
int foo = FOO_CONST;
where FOO_CONST is defined somewhere else.
In Pascal:
var MyFoo: Integer; attribute (name='foo') ; external; (untested)
Better yet:
const int foo = FOO_CONST;
var MyFoo: Integer; attribute (name = 'foo', const, external); ^^^^^
Then the compiler treats the variable as constant, so it can't be modified in the Pascal code by accident.
Alternative:
Pascal:
const foo = 42; { whichever value you choose }
C:
#define foo 42 /* same value as in Pascal */
void LogMessage (int Priority, char* MessagePtr) { [...] syslog (Priority == foo : FOO_CONST ? Priority == bar : BAR_CONST ? ... , MessagePtr); }
Hope you get the idea.
Then you have a constant in Pascal (but not necessarily the same value as FOO_CONST in C).
Frank