Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Call Java functions in a C DLL

Reply
Thread Tools

Call Java functions in a C DLL

 
 
Ahmad Jalil Qarshi
Guest
Posts: n/a
 
      10-20-2008
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
 
Reply With Quote
 
 
 
 
Flash Gordon
Guest
Posts: n/a
 
      10-20-2008
Ahmad Jalil Qarshi wrote, On 20/10/08 23:33:

<snip>

> 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.


<snip>

Make files are not topical on comp.lang.c nor is how to interface to
Java (because it is JAva that specifies this not C). Please keep the
discussion of this on groups where it is topical, and I'm guessing that
comp.unix.programmer and/or comp.unix.aix might be appropriate.
--
Flash Gordon
If spamming me sent it to http://www.velocityreviews.com/forums/(E-Mail Removed)
If emailing me use my reply-to address
See the comp.lang.c Wiki hosted by me at http://clc-wiki.net/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compare COM DLL and DLL with its exported functions Tony Johansson C++ 3 12-16-2004 02:37 AM
How to determine if a DLL is a COM DLL or .NET DLL Anushi ASP .Net 5 10-28-2004 01:59 PM
Why does Ruby use both tcl83.dll and tk83.dll (instead of just tk83.dll)? H. Simpson Ruby 4 08-03-2004 04:45 PM
mprapi.dll --> samlib.dll --> ntdll.dll issue. Some1 Computer Support 4 04-05-2004 02:02 AM
msvcrt.dll, msvcirt.dll, msvcrt20.dll and msvcrt40.dll, explanation please! Snoopy NZ Computing 16 08-25-2003 12:34 PM



Advertisments