Skip to Content.
Sympa Menu

freetds - [freetds] Library loading

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Richard Gibson <fluffy.gibson AT gmail.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] Library loading
  • Date: Thu, 29 Jul 2010 13:08:51 +0100

Hello

I am attempting to use FreeTDS, dynamically loading the library at runtime
in order to comply with the LGPL nature of the code when used in a
commercial application. Apologies in advance for stupid questions!

Anyway, I am unsure as to which library to load! On my system (Linux x64
Fedora 12), I have the following libraries:

/usr/lib64/libct.so
/usr/lib64/libsybdb.so
/usr/lib64/libtds.so
/usr/lib64/libtdsodbc.so

I know that libtdsodbc is for ODBC use, which I am not interested in. I also
believe that libtds is for internal use by the FreeTDS library - is this
correct?

So, I am left with libct and libsybdb. I know that there are three APIs
(db-lib, ct-lib and odbc) and I am looking to use either db-lib or ct-lib.
Which of the two libraries (libct and libsybdb) should I load? Does each .so
correspond to a certain API, or does one .so provide more than one API?

The reference docs that come with freetds for Fedora only mentions the
db-lib API and the ODBC API, in addition to the LibTDS API (which is for
internal use only, right?).

Additionally, what are the entry point function names? I can load the
library using dlopen, but then I need to use dlsym and get going. I have had
a quick look at the sample C programs included with the freetds-devel
package but am not sure where to start after loading the library.
I also extracted most of the functions in the .so using readelf -a but I'm
none the wiser.

Obviously, I need to:
1. Load the library
2. Initialise the library...?
3. Initialise a connection
4. Connect, submit some SQL
5. Check/read the results
6. Close the library
I can see steps 4 and 5 in the sample programs but am a bit stuck at step 2.

Many thanks in advance, all help greatly appreciated
Rich




Archive powered by MHonArc 2.6.24.

Top of Page