Create the shared library
You must compile dynthr.c into a
shared or static library. The following example illustrates how to
compile a shared or static library on a workstation running the Solaris
operating system:
% cc -c -DIFX_THREAD -I$ONEDB_HOME/incl/esql -D_REENTRANT -K pic
dynthr.c
% ld -G -o libdynthr.so dynthr.o
% cp libdynthr.so /usr/lib <== as root
You can also use the $LD_LIBRARY_PATH environment
variable:
% cc -c -DIFX_THREAD -I$ONEDB_HOME/incl/esql -D_REENTRANT -K pic
dynthr.c
% cp dynthr.so <some directory>
% setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:<some directory>
To compile dynthr.c into a static
library, perform the following tasks (on Solaris):
% cc -c -DIFX_THREAD -I$ONEDB_HOME/incl/esql -D_REENTRANT dynthr.c
% ar -cr dynthr.a dynthr.o
You must update your application, test.ec,
to call the dynthr_init() routine first, or none
of the thread functions are registered.
void main(argc , argv )
int argc;
char *argv[] ;
{ /* begin main */
/* First, set up the dynamic thread library */
dynthr_init();
/* Rest of program */
EXEC SQL database stores7;
;
}