Tuesday, March 25, 2008

write C connect TimesTen

I develope C on linux connect TimesTen. I had problem can't connect client/server because I didn't understand library on TimesTen more.

Thank You Chris Jenkins (Director, Solution Architectures, Oracle) for idea.

When we need to write C code connect to TimesTen [TimesTen has the TT library that is linked to the application], we have two choice;

- direct mode
use libtten.so library.

- client/server
use libttclient.so library.

When we write C code, we'll create Makefile file for make code:

Example:


INSTDIR = /oracle/product/TimesTen/ttmb
COMMDIR = $(INSTDIR)/demo/common
CC = gcc
PLATCFLAGS = -Os -finline-functions
LDFLAGS =
INCS = -I$(INSTDIR)/include -I$(COMMDIR)
CSDEFS = -DTTCLIENTSERVER
CFLAGS = $(PLATCFLAGS) $(INCS)
TTLINK = -L$(INSTDIR)/lib -Wl,-rpath,$(INSTDIR)/lib
DCLIBS = $(TTLINK) -ltten $(EXTRALIBS) # For Direct Mode
CSLIBS = $(TTLINK) -lttclient $(EXTRALIBS) # For Client/Server
PROGS = test3
all: $(PROGS)
clean:
rm -f $(PROGS) *.o
test3: test3.o
$(CC) -o $@ $(LDFLAGS) test3.o $(CSLIBS)
test3.o: test3.c
$(CC) $(CFLAGS) -o $@ -c test3.c


Enjoy!

No comments: