A
Ahmad Jalil Qarshi
Hi,
I am develop a dynamic link library in C on AIX that will internally
call java functions using JNI. This libaray will be finally used by
other C Executable.
There is only one function in C code i.e. Connect. This function
internally use JNI and call java functions. Now while compiling I am
facing problems. I think that there is some problem with my makefile.
The make file is given hereunder:
JAVA_HOME = /usr/java14
JAVA_INC = $(JAVA_HOME)/include
CC = cc
LD = cc
# Flags to create a dynamic library.
DYNLINKFLAGS = -G -ostdlib -bnoentry -bM:SRE -brtl -bE:Interface.exp
# files removal
RM = rm -f
#------------------------------------- Libs
-----------------------------------#
JAVALIBS = -L$(JAVA_HOME)/jre/bin/classic/
LIBS = -ljvm -lpthread -lxnet -lnsl -lm -ldl
#-------------------------------- Dependency
rules---------------------------#
# shared library files
LIB_FILES = Interface.a
#-------------------------------------
OBJs-------------------------------------#
# shared libraries object files
LIB_OBJS = Interface.o
all: $(LIB_FILES)
# create our librarys
Interface.a: Interface.o
$(LD) $(DYNLINKFLAGS) $(JAVALIBS) $(LIBS) $(LIB_OBJS) -o $@
# compile C source files into object files.
%.o: %.c
$(CC) $(DYNLINKFLAGS) -L$(JAVA_INC) -c $<
# clean everything
clean:
$(RM) $(LIB_OBJS) $(LIB_FILES)
# clean the library's object files only
cleanlibobjs:
$(RM) $(LIB_OBJS)
Now the problem is that library is not properly created because the
size of the Interface.a file is very small only 552 bytes. whereas the
size of Interface.o file is 34428. Which clearly indicates that the
problem is with the Interface.a file i.e during linking.
Can any body help me to figure out the problem.
Regards,
Ahmad Jalil Qarshi
I am develop a dynamic link library in C on AIX that will internally
call java functions using JNI. This libaray will be finally used by
other C Executable.
There is only one function in C code i.e. Connect. This function
internally use JNI and call java functions. Now while compiling I am
facing problems. I think that there is some problem with my makefile.
The make file is given hereunder:
JAVA_HOME = /usr/java14
JAVA_INC = $(JAVA_HOME)/include
CC = cc
LD = cc
# Flags to create a dynamic library.
DYNLINKFLAGS = -G -ostdlib -bnoentry -bM:SRE -brtl -bE:Interface.exp
# files removal
RM = rm -f
#------------------------------------- Libs
-----------------------------------#
JAVALIBS = -L$(JAVA_HOME)/jre/bin/classic/
LIBS = -ljvm -lpthread -lxnet -lnsl -lm -ldl
#-------------------------------- Dependency
rules---------------------------#
# shared library files
LIB_FILES = Interface.a
#-------------------------------------
OBJs-------------------------------------#
# shared libraries object files
LIB_OBJS = Interface.o
all: $(LIB_FILES)
# create our librarys
Interface.a: Interface.o
$(LD) $(DYNLINKFLAGS) $(JAVALIBS) $(LIBS) $(LIB_OBJS) -o $@
# compile C source files into object files.
%.o: %.c
$(CC) $(DYNLINKFLAGS) -L$(JAVA_INC) -c $<
# clean everything
clean:
$(RM) $(LIB_OBJS) $(LIB_FILES)
# clean the library's object files only
cleanlibobjs:
$(RM) $(LIB_OBJS)
Now the problem is that library is not properly created because the
size of the Interface.a file is very small only 552 bytes. whereas the
size of Interface.o file is 34428. Which clearly indicates that the
problem is with the Interface.a file i.e during linking.
Can any body help me to figure out the problem.
Regards,
Ahmad Jalil Qarshi