any thoughts? (fwd) 
Author Message
 any thoughts? (fwd)

Hey there.. wondering if any of you might be able to help me.

I have written a C++ program that execs a Perl script using perl_parse and
perl_run.

Note that prior to invoking perl_parse and perl_run this C++ program
creates a db connection (called G_database) using the RogueWave C++
library's RWDBDatabase class (which uses Sybase DBlib).

Also note that in the Perl script that the perl_run function executes
there is the following line:

   require Sybase::DBlib;

The trouble is this: after perl_run returns, the db connection created
using RogueWave (G_database) (actually the DBPROCESS associated with
it) seems to have been corrupted somehow.

You can see this by looking at the output from the following piece of my
code, which consists of the perl_run command sandwiched by database status
checks and print statments:

         cerr <<"******************************************" << endl;
         RWDBStatus status = G_database.status();
         cerr << "database status: "
              << status.errorCode()
              << " ("
              << status.message()
              << ")"
              << endl;
         if (!G_database.connection().isValid()) {
            cerr << "database connection not valid" << endl;
         } else {
            cerr << "database connection valid" << endl;
         }
         cerr << "******************************************" << endl;

    int runResult = perl_run(perlInterpreter_);

         cerr << "******************************************" << endl;
         status = G_database.status();
         cerr << "database status: "
              << status.errorCode()
              << " ("
              << status.message()
              << ")"
              << endl;
         if (!G_database.connection().isValid()) {
            cerr << "database connection not valid" << endl;
         } else {
            cerr << "database connection valid" << endl;
         }
         cerr << "******************************************" << endl;

Here is that output:

   *****************************************************
   database status: 0 ()
   database connection valid
   database connection status: 0 ()
   *****************************************************
   *****************************************************
   database status: 0 ()
   DB-Library: NULL DBPROCESS pointer passed to DB-Library.

(After outputting this the program dies.)

So it looks like while the RogueWave db status bit is not getting
thrown, the db connection (G_database) has nonetheless somehow been
altered.

Note that if I removed the "require" line from the Perl script the problem
goes away (as expected). (Trouble is, the Perl script needs to do some db
work... so the require line cannot be removed.)

I suspect that when perl_run completes execution of the Perl script
containing the require Sybase::Dblib line it is doing come sort of
cleanup (pointer descruction) that is affcting the C++ program's db
connection.

If one of you Perl experts can give me some better idea of what is/might
be happening and/or how I might remedy the situation I would be most
grateful.

My email adddress is in my .sig below.

KJ


Senior Software Engineer, CNET Inc. (Nasdaq: CNET)
908-575-7400 x225



Sun, 26 Aug 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. (fwd) Re: Best ptk documentation? (fwd)

2. Fwd: Aqua Tcl/Tk (fwd)

3. thoughts on while(defined(EXP warnings

4. Novel Thoughts on Scripting and Languages

5. Thoughts on Text::Wrap, and perhaps a Text::Justify

6. I thought I understood local()

7. Thoughts about GUI objects

8. Variable evaluation, and some other thoughts

9. thought you all might like this...

10. thoughts on use strict 'vars';

11. Just when I thought I knew perl...

12. PDK 4.0 - Thoughts ???

 

 
Powered by phpBB® Forum Software