ProC Host Variables as global [message #342874] |
Mon, 25 August 2008 07:43 |
donato
Messages: 53 Registered: November 2007 Location: Barcelona, Spain
|
Member |
|
|
Hi people!
I Want to declare some host variables with global scope. Like this C variable:
MyFile.h
...
char str_var[20];
...
But i can't put SQL sentences in a include file. And if i do this:
MyFile.pc
...
EXEC SQL BEGIN DECLARE SECTION;
char str_var_h[20];
EXEC SQL END DECLARE SECTION;
...
... i can't see this variable from others sources, although I declare it like 'extern'.
Probably it's very easy to solve, but i'm really mentally blocked... Can anybody help me, please?
Thanks in advance!!
[Updated on: Tue, 26 August 2008 07:04] Report message to a moderator
|
|
|
Re: ProC Host Variables as global [message #343136 is a reply to message #342874] |
Tue, 26 August 2008 07:17 |
donato
Messages: 53 Registered: November 2007 Location: Barcelona, Spain
|
Member |
|
|
Hi people!
That's my solution:
MyFile.h
...
char str_var[20];
...
MyFile.pc
...
EXEC SQL BEGIN DECLARE SECTION;
char str_var_h[20];
EXEC SQL END DECLARE SECTION;
void c_var_to_host();
void host_var_to_c();
/* I call this functions when needed. The C and Host
variables always will be with the same value */
void c_var_to_host()
{ strcpy(str_var_h, str_var); }
void host_var_to_c()
{ strcpy(str_var, str_var_h); }
...
It's an ugly solution, but it's the first i thought.
Thanks people!
|
|
|