Re: Shared Library registration with regcomp

Ocke Janssen <[email protected]> Wed, 06 Apr 2011 08:42:24 +0200
Newsgroups gmane.comp.openoffice.dba.devel
Organization ORACLE Deutschland B.V. & Co. KG
Message-ID <[email protected]>
Hi Rohit,

I change and add some lines.

On 05.04.2011 14:40, Rohit Kulkarni wrote:
> Hello,
> Thank you for your help.
>
> I understand what you are trying to tell me.
> I understand why I cant regcomp the lib file from connectivity module.
> Now can you please tell me what is wrong in my map file and makefile.
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D makefile.m=
k <http://makefile.mk>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> PRJ=3D..$/..$/..
> PRJINC=3D..$/..
> PRJNAME=3Dconnectivity
> TARGET=3DDriverSkeleton
>
> ENABLE_EXCEPTIONS=3DTRUE
> VISIBILITY_HIDDEN=3DTRUE
>
> # --- Settings ----------------------------------
> .IF "$(DBGUTIL_OJ)"!=3D""
> ENVCFLAGS+=3D/FR$(SLO)$/
> .ENDIF
>
> .INCLUDE : $(PRJ)$/makefile.pmk
> .INCLUDE : $(PRJ)$/version.mk <http://version.mk>
>
> # --- Files -------------------------------------
> SLOFILES=3D\
>          $(SLO)$/SResultSet.obj                  \
>          $(SLO)$/SStatement.obj                  \
>          $(SLO)$/SPreparedStatement.obj  \
>          $(SLO)$/SDatabaseMetaData.obj   \
>          $(SLO)$/SConnection.obj                 \
>          $(SLO)$/SServices.obj                   \
>          $(SLO)$/SResultSetMetaData.obj                   \
>          $(SLO)$/SDriver.obj
>
> SHL1VERSIONMAP=3D $(TARGET).map
Change to
SHL1VERSIONMAP=3D$(SOLARENV)/src/component.map
>
> # --- Library -----------------------------------
> SHL1TARGET=3D$(TARGET)$(DLLPOSTFIX)
> SHL1OBJS=3D$(SLOFILES)
> SHL1STDLIBS=3D\
>          $(CPPULIB)                                      \
>          $(CPPUHELPERLIB)                        \
>          $(TOOLSLIB)                                     \
>          $(SALLIB)                                       \
>          $(DBTOOLSLIB)                           \
>          $(COMPHELPERLIB)
> SHL1DEPN=3D
> SHL1IMPLIB=3D i$(TARGET)
>
> SHL1DEF=3D $(MISC)$/$(SHL1TARGET).def
>
> DEF1NAME=3D $(SHL1TARGET)
> DEF1EXPORTFILE=3D exports.dxp

>
> # --- Targets ----------------------------------
>
> .INCLUDE : $(PRJ)$/target.pmk

Add these lines
ALLTAR : $(MISC)/skeleton.component

$(MISC)/skeleton.component .ERRREMOVE :=20
$(SOLARENV)/bin/createcomponent.xslt \
         skeleton.component
     $(XSLTPROC) --nonet --stringparam uri \
         '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
         $(SOLARENV)/bin/createcomponent.xslt skeleton.component

Copy mysql.component to skeleton.component

- oj
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D
>
> Also my .map file is,
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3DDriverSkeleton.map=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> DRIVERSKELETON_2_0 {
>          global:
>                  component_getImplementationEnvironment;
>                  component_writeInfo;
>                  component_getFactory;
>          local:
>                  *;
> };
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D
>
> And exports.dxp is,
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3Dexports.dxp=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D
> component_getImplementationEnvironment
> component_writeInfo
> component_getFactory
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D
>
> All above files are under " connectivity/source/drivers/DriverSkeleton =
"
> this path.
> Are above files are correct and if so what goes wrong ?
> Also, can you tell me what is the use of SServices.cxx file ?
> And what should I write below " SHL1STDLIBS=3D\ " this in makefile.mk
> <http://makefile.mk> ?
>
> Regards,
> Rohit
>
> 2011/4/4 Frank Sch=F6nheit <[email protected]
> <mailto:[email protected]>>
>
>     Hi Rohit,
>
>      > I am trying to register the library (.so) file for the example
>     skeleton
>      > sdbc driver using "regcomp" tool into the services.rdb file. Whe=
n
>     I try
>      > to register the shared library in "connection/unxlngi6.pro/lib
>     <http://unxlngi6.pro/lib>
>
>     I suppose you mean "connectivity/unxlngi6.pro/lib
>     <http://unxlngi6.pro/lib>" here, i.e. the local
>     output tree of the "connectivity" module?
>
>      > <http://unxlngi6.pro/lib>" directory it fails giving
>      > "CannotRegisterImplementationException" exception.
>      >
>      > However during the build process this library is copied into
>      > 'solver//330/unxlngi6.pro <http://unxlngi6.pro>
>     <http://unxlngi6.pro>" directory and when I
>      > try to register this file it succeeds !
>      >
>      > Could anyone tell me what changes happen to the library files du=
ring
>      > build process when they are copied into the solver directory?
>
>     I suppose this is a LD_LIBRARY_PATH problem: your library is probab=
ly
>     linked against other libraries from URE (the UNO runtime environmen=
t),
>     which, in a complete build, also reside in
>     $SOLVER/330/unxlngi6.pro/lib <http://unxlngi6.pro/lib>.
>     So, if your library resides there, too, and your LD_LIBRARY_PATH
>     contains ".", then loading the lib succeeds. Loading the lib in the
>     local output tree doesn't succeed, since the loader doesn't find th=
e URE
>     libs there.
>
>     To verify this, try "ldd <lib_name>" to see which libs your actual =
lib
>     needs, and whether the loader finds them.
>
>      > My problem is that the my sdbc driver library is supposed to
>     implement
>      > com.sun.star.sdbc.Driver service but when I register it from
>     solver it
>      > is implementing some strange services like
>      > "com.sun.star.comp.svl.PathService" and
>      > "com.sun.star.uno.util.numbers.SvNumberFormatterServiceObject"
>     hence I
>      > am wondering if something is changing the library during the
>     build process.
>
>     This means that you don't export the proper symbols from your libra=
ry,
>     which most probably means your map file is wrong. Look into an othe=
r
>     driver's makefile.mk <http://makefile.mk>, search for a directive
>     referring to a file
>     component.map, and copy this for your driver.
>
>     Background: since your driver doesn't export the necessary "compone=
nt_*"
>     functions, which are looked by by the UNO component registration
>     process, those functions are taken from another (random) library wh=
ich
>     your actual library links to. And those other functions, in your ca=
se
>     obviously originating from the libsvl* library, write their very UN=
O
>     component information.
>
>     Note that what you're doing is a component with so-called active
>     registration, which is deprecated. Passive registration is to be
>     preferred nowadays, it means that instead of adding (active) code t=
o
>     your library which describes the UNO components it exports, you pla=
ce an
>     XML file near your lib, and describe the components therein. See
>     http://wiki.services.openoffice.org/wiki/Passive_Component_Registra=
tion
>     for details.
>
>     This completely avoids the regcomp stuff, though at the moment, I a=
m not
>     sure how to integrate those passive registration into the
>     build/deployment process. I think you can learn from other modules =
here,
>     too - VCL comes to mind, look into vcl/util/vcl.component, and how =
it is
>     used.
>
>     HTH
>
>     Ciao
>     Frank
>     --
>     -----------------------------------------------------------------
>     To unsubscribe send email to [email protected]
>     <mailto:[email protected]>
>     For additional commands send email to [email protected]
>     <mailto:[email protected]>
>     with Subject: help
>
>

--
-----------------------------------------------------------------
To unsubscribe send email to [email protected]
For additional commands send email to [email protected]
with Subject: help