[xsde-users] XSD/e shared library

Boris Kolpackov boris at codesynthesis.com
Thu Jul 2 21:52:41 EDT 2009


Hi Laxmi,

Laxmi Thota <lthota at yahoo.com> writes:

> Currently XSD/e is available as a static library. Can it be compiled 
> and used as shared library?

There is no out of the box support for building the runtime as a 
shared library but it should be quite easy to add. You can add 
the necessary C++ compiler options (e.g., -fPIC) to CFLAGS and
CXXFLAGS variables in config.make. Then you can replace the
following lines in libxsde/xsde/makefile:

libxsde.a: $(obj)
	$(AR) $(ARFLAGS) $@ $^
ifneq ($(RANLIB),)
	$(RANLIB) $@
endif

With something like this:

libxsde.so: $(obj)
	$(CXX) -shared -o $@ $^


> Do you see any issues with it being used as a shared library.

No, there shouldn't be any problems.


> Is it thread safe?

The runtime library and generated code are thread-safe in the sense 
that you can use different instantiations of the parsers, serializers,
and object models in several threads concurrently. This is possible
because we do not relying on any writable global variables. 

If you need to share the same parser, serializer, or object model 
between several threads then you will need to provide some form of
synchronization to make sure these objects are not accessed from
more than one thread at a time.  

Boris



More information about the xsde-users mailing list