Re: Pro*C++ and global variables.

From: John Smith <someone_at_microsoft.com>
Date: Sat, 27 Oct 2001 02:22:25 GMT
Message-ID: <BToC7.3999$wM4.313667_at_typhoon2.gnilink.net>


Usually I have found that this structure works well for me in a ProC++ program..

  1. All the stuff between the EXEC SQL BEGIN DECLARE SECTION and EXEC SQL END DECLARE SECTION
  2. #include <myclass.h>
  3. Functions defining the methods in myclass.h These contain the sql calls etc.

The include file can be used by the other calling programs.

One thing to note is that to try to keep the processing logic to a minimum in the ProC++ file. This is because if you compile using proc, it usually gives you a million warnings when you try to include data and function types from the new type of STL class declaration e.g. <vector> or <maps>, since the code is not fully parsed.

Hope this helps...
Jay Jay

"Atul Pinge" <apinge_at_carl.org> wrote in message news:5939461c.0110260907.6276c734_at_posting.google.com...
> Hello everybody,
>
> I started working with Pro*C++ preprocessor and it's turning out to be
> quite a nightmare. Looks like the preprocessor generates global
> variables in the file where we are using EXEC SQL statements. So does
> that mean that you are allowed to use all the EXEC SQL statements only
> in one source file? Because otherwise, I get "This global variable
> already defined" kind of errors. Also, looks like the preprocessor
> can look at variables defined between EXEC SQL BEGIN DECLARE SECTION
> and EXEC SQL END DECLARE SECTION. So does that mean that I cannot
> define any variable inside .h file where class is declared? Because
> if it is going to generate global variables in .h file then every
> place the .h file is included the global variables are going to get
> defined again. Is there a solution to this problem?
>
> Thanks in advance.
> Atul
Received on Sat Oct 27 2001 - 04:22:25 CEST

Original text of this message