Re: Shared Library registration with regcomp

Rohit Kulkarni <[email protected]> Tue, 5 Apr 2011 18:10:28 +0530
Newsgroups gmane.comp.openoffice.dba.devel
Message-ID <[email protected]>
--0016e64c0b8c59983004a02b2e00
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

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

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

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

=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=3D=
DriverSkeleton.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 ?

Regards,
Rohit

2011/4/4 Frank Sch=F6nheit <[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. When I try
> > to register the shared library in "connection/unxlngi6.pro/lib
>
> I suppose you mean "connectivity/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>" directory and when I
> > try to register this file it succeeds !
> >
> > Could anyone tell me what changes happen to the library files during
> > build process when they are copied into the solver directory?
>
> I suppose this is a LD_LIBRARY_PATH problem: your library is probably
> linked against other libraries from URE (the UNO runtime environment),
> which, in a complete build, also reside in $SOLVER/330/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 the 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 library,
> which most probably means your map file is wrong. Look into an other
> driver's 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 "component_*"
> functions, which are looked by by the UNO component registration
> process, those functions are taken from another (random) library which
> your actual library links to. And those other functions, in your case
> obviously originating from the libsvl* library, write their very UNO
> 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 to
> your library which describes the UNO components it exports, you place an
> XML file near your lib, and describe the components therein. See
> http://wiki.services.openoffice.org/wiki/Passive_Component_Registration
> for details.
>
> This completely avoids the regcomp stuff, though at the moment, I am 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]
> For additional commands send email to [email protected]
> with Subject: help
>
--
-----------------------------------------------------------------
To unsubscribe send email to [email protected]
For additional commands send email to [email protected]
with Subject: help

--0016e64c0b8c59983004a02b2e00
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hello,<br>Thank you for your help.<br><br>I understand what you are trying =
to tell me.<br>I understand why I cant regcomp the lib file from connectivi=
ty module.<br>Now can you please tell me what is wrong in my map file and m=
akefile.<br>
<br>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D <a href=3D=
"http://makefile.mk">makefile.mk</a> =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<br><br>PRJ=3D..$/..$/..<br>PRJINC=3D..$/.=
.<br>PRJNAME=3Dconnectivity<br>TARGET=3DDriverSkeleton<br><br>ENABLE_EXCEPT=
IONS=3DTRUE<br>
VISIBILITY_HIDDEN=3DTRUE<br><br># --- Settings ----------------------------=
------<br>.IF &quot;$(DBGUTIL_OJ)&quot;!=3D&quot;&quot;<br>ENVCFLAGS+=3D/FR=
$(SLO)$/<br>.ENDIF<br><br>.INCLUDE : $(PRJ)$/makefile.pmk<br>.INCLUDE : $(P=
RJ)$/<a href=3D"http://version.mk">version.mk</a><br>
<br># --- Files -------------------------------------<br>SLOFILES=3D\<br>=
=A0=A0=A0=A0=A0=A0=A0 $(SLO)$/SResultSet.obj=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0 \<br>=A0=A0=A0=A0=A0=A0=A0 $(SLO)$/SStatement.obj=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 \<br>=A0=A0=A0=A0=A0=A0=A0=
 $(SLO)$/SPreparedStatement.obj=A0 \<br>
=A0=A0=A0=A0=A0=A0=A0 $(SLO)$/SDatabaseMetaData.obj=A0=A0 \<br>=A0=A0=A0=A0=
=A0=A0=A0 $(SLO)$/SConnection.obj=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0 \<br>=A0=A0=A0=A0=A0=A0=A0 $(SLO)$/SServices.obj=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 \<br>=A0=A0=A0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ARGET)<br><br>SHL1DEF=3D $(MISC)$/$(SHL1TARGET).def<br><br>DEF1NAME=3D $(SH=
L1TARGET)<br>DEF1EXPORTFILE=3D exports.dxp<br><br># --- Targets -----------=
-----------------------<br>
<br>.INCLUDE : $(PRJ)$/target.pmk<br><br>=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<br><br>Also=
 my .map file is,<br><br>=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<br>
<br>DRIVERSKELETON_2_0 {<br>=A0=A0=A0=A0=A0=A0=A0 global:<br>=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 component_getImplementationEnvironment;<b=
r>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 component_writeInfo;<br>=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 component_getFactory;<br>=A0=A0=
=A0=A0=A0=A0=A0 local:<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 *;<=
br>
};<br><br>=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<br><br>And exports.dxp is,<br><br>=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=3Dexp=
orts.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<br=
>component_getImplementationEnvironment<br>
component_writeInfo<br>component_getFactory<br><br>=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<br=
><br>All above files are under =A0 &quot; connectivity/source/drivers/Drive=
rSkeleton &quot; this path.<br>
Are above files are correct and if so what goes wrong ?<br>Also, can you te=
ll me what is the use of SServices.cxx file ?<br>And what should I write be=
low &quot; SHL1STDLIBS=3D\ &quot; this in <a href=3D"http://makefile.mk">ma=
kefile.mk</a> ?<br>
<br>Regards,<br>Rohit<br><br><div class=3D"gmail_quote">2011/4/4 Frank Sch=
=F6nheit <span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]=
m">[email protected]</a>&gt;</span><br><blockquote class=3D"gmail=
_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204,=
 204, 204); padding-left: 1ex;">
Hi Rohit,<br>
<div class=3D"im"><br>
&gt; I am trying to register the library (.so) file for the example skeleto=
n<br>
&gt; sdbc driver using &quot;regcomp&quot; tool into the services.rdb file.=
 When I try<br>
&gt; to register the shared library in &quot;connection/<a href=3D"http://u=
nxlngi6.pro/lib" target=3D"_blank">unxlngi6.pro/lib</a><br>
<br>
</div>I suppose you mean &quot;connectivity/<a href=3D"http://unxlngi6.pro/=
lib" target=3D"_blank">unxlngi6.pro/lib</a>&quot; here, i.e. the local<br>
output tree of the &quot;connectivity&quot; module?<br>
<br>
&gt; &lt;<a href=3D"http://unxlngi6.pro/lib" target=3D"_blank">http://unxln=
gi6.pro/lib</a>&gt;&quot; directory it fails giving<br>
<div class=3D"im">&gt; &quot;CannotRegisterImplementationException&quot; ex=
ception.<br>
&gt;<br>
&gt; However during the build process this library is copied into<br>
</div>&gt; &#39;solver//330/<a href=3D"http://unxlngi6.pro" target=3D"_blan=
k">unxlngi6.pro</a> &lt;<a href=3D"http://unxlngi6.pro" target=3D"_blank">h=
ttp://unxlngi6.pro</a>&gt;&quot; directory and when I<br>
<div class=3D"im">&gt; try to register this file it succeeds !<br>
&gt;<br>
&gt; Could anyone tell me what changes happen to the library files during<b=
r>
&gt; build process when they are copied into the solver directory?<br>
<br>
</div>I suppose this is a LD_LIBRARY_PATH problem: your library is probably=
<br>
linked against other libraries from URE (the UNO runtime environment),<br>
which, in a complete build, also reside in $SOLVER/330/<a href=3D"http://un=
xlngi6.pro/lib" target=3D"_blank">unxlngi6.pro/lib</a>.<br>
So, if your library resides there, too, and your LD_LIBRARY_PATH<br>
contains &quot;.&quot;, then loading the lib succeeds. Loading the lib in t=
he<br>
local output tree doesn&#39;t succeed, since the loader doesn&#39;t find th=
e URE<br>
libs there.<br>
<br>
To verify this, try &quot;ldd &lt;lib_name&gt;&quot; to see which libs your=
 actual lib<br>
needs, and whether the loader finds them.<br>
<div class=3D"im"><br>
&gt; My problem is that the my sdbc driver library is supposed to implement=
<br>
&gt; com.sun.star.sdbc.Driver service but when I register it from solver it=
<br>
&gt; is implementing some strange services like<br>
&gt; &quot;com.sun.star.comp.svl.PathService&quot; and<br>
&gt; &quot;com.sun.star.uno.util.numbers.SvNumberFormatterServiceObject&quo=
t; hence I<br>
&gt; am wondering if something is changing the library during the build pro=
cess.<br>
<br>
</div>This means that you don&#39;t export the proper symbols from your lib=
rary,<br>
which most probably means your map file is wrong. Look into an other<br>
driver&#39;s <a href=3D"http://makefile.mk" target=3D"_blank">makefile.mk</=
a>, search for a directive referring to a file<br>
component.map, and copy this for your driver.<br>
<br>
Background: since your driver doesn&#39;t export the necessary &quot;compon=
ent_*&quot;<br>
functions, which are looked by by the UNO component registration<br>
process, those functions are taken from another (random) library which<br>
your actual library links to. And those other functions, in your case<br>
obviously originating from the libsvl* library, write their very UNO<br>
component information.<br>
<br>
Note that what you&#39;re doing is a component with so-called active<br>
registration, which is deprecated. Passive registration is to be<br>
preferred nowadays, it means that instead of adding (active) code to<br>
your library which describes the UNO components it exports, you place an<br>
XML file near your lib, and describe the components therein. See<br>
<a href=3D"http://wiki.services.openoffice.org/wiki/Passive_Component_Regis=
tration" target=3D"_blank">http://wiki.services.openoffice.org/wiki/Passive=
_Component_Registration</a><br>
for details.<br>
<br>
This completely avoids the regcomp stuff, though at the moment, I am not<br>
sure how to integrate those passive registration into the<br>
build/deployment process. I think you can learn from other modules here,<br>
too - VCL comes to mind, look into vcl/util/vcl.component, and how it is<br>
used.<br>
<br>
HTH<br>
<br>
Ciao<br>
Frank<br>
<font color=3D"#888888">--<br>
-----------------------------------------------------------------<br>
To unsubscribe send email to <a href=3D"mailto:[email protected]=
ce.org">[email protected]</a><br>
For additional commands send email to <a href=3D"mailto:[email protected]=
e.org">[email protected]</a><br>
with Subject: help<br>
</font></blockquote></div><br>

--0016e64c0b8c59983004a02b2e00--