Re: Definition techniques using ESQL-C
Posted in 1992
Rory Martin writes: [ in response to the question:] >> I am a bit confused about how to do something that seems like it should >> be easy. I want to define a structure that can be used in both an >> ESQL-C source file and a standard c file. It seems that if I make >> a standard header file defining the structure using the standard >> c syntax ( struct foo { int bar; }; ), ESQL-C won't let me create a >> host variable of type struct foo. It only works if i use the following >> syntax ( $struct foo { int bar; }; ). This of course messes things >> up for standard c. > >Jon, >If anyone comes up with a reasonable way of doing this, let me know. >When I was confronted with the problem, I only found two ways of handling it. >The first was the obvious, having two separate include files, one for the >ESQL program and one for the standard C program. >The second was to duplicate the structure inside the same file using >the '$struct foo' in one and the plain 'struct foo' in the other. >Then using #ifdef ESQL for the ESQL structure. >Both of these require you to update both structures; at least the second >one puts them both in the same file. >If anyone has a cleaner way of doing this I would certainly appreciate >hearing about it. > You could make everything a .ec file (even if it contains no SQL) and compile it with esql. Then all your structs can be $structs. Dave -- Disclaimer: These opinions are not those of Informix Software, Inc. ************************************************************************** "I look back with some satisfaction on what an idiot I was when I was 25, but when I do that, I'm assuming I'm no longer an idiot." - Andy Rooney