First let me recommend a good book on this topic "Advanced Perl Programming"
published by O'Reilly.  Really covers XS deeply and thoroughly.  Might help.

I've never embedded DBI/DBD's in any C/C++ program, so I'll leave it for
others to comment.  I can imagine there would be some platform dependent
issues with that since DBD's are usually compiled for specific platforms
since most use C libs to communicate.  I've had problems before embedding
modules that were somehow dependent on other libs and/or modules.
I do have experience though, communicating data from a perl script to C/C++
and reverse.  I've mostly used http sockets since most of the work I do
deals with servers.  SOAP::Lite might be another module (and SOAP in
general) that you want to look into.  If the C++ app and the perl app are on
the same machine, than you can just start a new process with your app and
feed the data to stdin.  Worked really great for me, but also depends on the
network, resources, etc...  Not a problem in my environment since it's all
servers are broadband connected.

Ilya Sterin

-----Original Message-----
From: Sterin, Ilya [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 08, 2001 11:05 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: FW: Encapsulate DBI in C++ (On behalf of Mark Riehl)


****Email on behalf of Mark Riehl (he is having problems posting****

All,

What's the best way to approach this?  I'm trying to put together an
application that needs to be flexible enough to use multiple databases
(MySQL and Oracle are the first two).  I've done some experimenting with
Perl/DBI standalone scripts and it works great.  I'd like to get this
interface into a C/C++ application.  There are a few examples in v3 of
the Camel book.

Questions:
1. Is there a way to embed the DBI Perl module into a C++ app or should
I write a Perl subroutine and call it from C++?
2. Am I better off just using a standalone Perl process and pass the
data to the C++ app via a socket?
3. In either approach, are there any platform dependent issues that I
need to be aware of?  My initial platforms would need to include Win2k,
Linux, and Solaris.
4. If a Perl program contains a subroutine that I want to call from a
C++ program (e.g., DBI calls), how do I get a handle to the return data?
The examples in the Camel book are similar to making system calls.

Any advice/suggestions would be appreciated.

Thanks,
Mark

--
Mark Riehl

Reply via email to