[openamq-dev] Help on shared Object

Dmitri Tsyganov dmitri.tsyganov at dowjones.com
Fri Sep 14 17:12:26 CEST 2007


Hi Malinda,

We do build shared libraries on LINUX (and AIX). 

What you will need to do is:

	1) Build OpenAMQ as usual - that produces static (archive, .a) libs.
You will find them in $(IBASE)/lib directory.

	2) Build your library as shared object (.so), statically linking
against Open AMQ libraries. 

You may have something like this in your Makefile:

***
IBASE_LIB = -L $(IBASE)/lib -lamq_wireapi -lamq_common -lsmt -licl -lip-
lasl -lapr -laprutil -lpcre

LIB = $(IBASE_LIB) $(YOUR_OTHER_LIB)

$(CXX) -D_REENTRANT $(LFLAGS)$(LIB_SONAME) -o $(LIB_NAME_V_M_R)
your_amq_code.o $(LIB)
***
and the last line will probably translate into something like this,
depending on your environment:

g++ -shared -Wl,-soname,libyour_amq_library_name.so.0 -o
libyour_amq_library_name.so.0.0.0  your_amq_code.o  -L /ibase/lib -
lamq_wireapi -lamq_common -lsmt -licl -lipr -lasl -lapr -laprutil -lpcre
-L ...

Now you have your shared .so lib.

Note: If you are on 64 bit platform (as I am), you may have to build
OpenAMQ libs and your library with -fPIC flag. 
To do that, please define 
	CCDEFINES = -fPIC
	CFLAGS = -fPIC
before building OpenAMQ. Make sure you are on version 1.2c4

Hope this helps,

Dmitri
	

On Thu, 2007-09-13 at 11:30 +0200, Martin Sustrik wrote:
> Malinga wrote:
> > Hi Experts,
> > 
> >     Hi can i get a shared object (so) file of OpenAMQ. Its just beacuse 
> > i want to build a Shared Object to be used by the JNI currently what im 
> > doing is link my code against your Object files (.o). But its a pain. 
> > Any plans on shared objects of OpenAMQ ?
> 
> For windows, there are DLLs available.
> 
> For UNIX, you have to build shared objects yourself.
> 
> However, adding support for shared objects to our build system is on our 
> todo list.
> 
> BTW, there are several people on the list who already built shared 
> libraries. Wouldn't you like to share your experience?
> 
> Thanks.
> Martin
> _______________________________________________
> openamq-dev mailing list
> openamq-dev at lists.openamq.org
> http://lists.openamq.org/mailman/listinfo/openamq-dev


More information about the openamq-dev mailing list