[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
DLM returning a pointer...
- Subject: DLM returning a pointer...
- From: Randall Skelton <rhskelto(at)atm.ox.ac.uk>
- Date: Mon, 23 Apr 2001 20:38:44 +0100
- Newsgroups: comp.lang.idl-pvwave
- Organization: Oxford University, England
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:24654
I am trying to write a few IDL functions which mirror those of a C library
I frequently use for getting data directly from a unix database
connection. My problem is that the interface document states that the
internal C structures should not be directly used; rather, an additional
layer of abstraction should be used. The basic operation that I want in
IDL is the ability to (1) connect to the database, (2) give a string of
queries, (3) get a stream of data, and (4) close the connection.
Ideally, I would like each of these steps to be a separate IDL function
that mirrors the C functions. Implementing step 1 is proving to be
somewhat difficult with the abstraction requirement. In order to establish
a connection I use a C function:
DBcon *DBconSet(char *host, char *port, char *dbName, ...)
which returns DBconn (a nasty structure that, for the reasons above, I
don't want to emulate directly in IDL). Nevertheless, this structure is
passed in subsequent functions so I need the structure to proceed with
steps 2, 3, and 4.
DBresult *DBexecute(DBconn *connection, const char *query)
char *DBgetval(DBconn *connection, int tup, int index)
Is it possible to return a pointer from C -> IDL such that I can pass a
pointer of the DBcon memory block in subsequent functions from IDL -> C?
Does anyone have any code that shows how to do this?
Thanks in advance,