Avahi Support on Linux

Siqi Liu me at siqi.fr
Wed Jan 29 16:35:00 PST 2014


Hello,

The code using avahi_client_new is already in LibreOffice (I've pushed it
during last summer).

I've tried to make a separate version of that same code broadcasting a
_impressremote._tcp service alone. Even though the code compiles fine using
dlopen, it does get an error code that I've never encountered before... In
theory avahi.cxx will broadcast avahi service in a event loop thread, does
dlopen change anything with respect to that? Also, internally avahi is
based on dbus, not sure if that has anything to do with the issue.

For now, the problem is that the service can not get committed
using avahi_entry_group_commit().

I've attached the code if you have some time to check if I've used dlopen
correctly.


The command that I've used to compile it is as follow

g++ avahi.cxx -I/usr/include/dbus-1.0 \
           -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include \
           -I/usr/include/glib-2.0 \
           -I/usr/lib/x86_64-linux-gnu/glib-2.0/include/ \
           -ldbus-1 \
           -ldbus-glib-1 \
           -lavahi-glib -lavahi-common -lavahi-core -lavahi-client -ldl


Thanks!
Siqi


On Wed, Jan 29, 2014 at 12:09 PM, Caolán McNamara <caolanm at redhat.com>wrote:

> On Fri, 2014-01-24 at 22:51 +0100, Siqi Liu wrote:
> >
> > For example, I can dlsym this function and get the void * to it, but
> > how can I use it if I don't have access to the struct AvahiClient
> > (declaired in the shared object)?
> > AvahiClient* avahi_client_new
> > (
> > const AvahiPoll *
> > poll_api,
> >
> >
> > AvahiClientFlags
> > flags,
> >
> >
> > AvahiClientCallback
> > callback,
> >
> >
> > void *
> > userdata,
> >
> >
> > int *
> > error
> >
> >
>
> Well, it depends on usage if you can get away with including the
> headers. e.g. if you just need to manipulate the returned thing through
> a pointer to it and dlsymed functions then you can just shove e.g.
> typedef struct _AvahiClient AvahiClient;
> into your .cxx and that'll work.
>
> e.g. see vcl/unx/gtk/window/xid_fullscreen_on_all_monitors.c for an
> example
>
> Is the code using avahi_client_new that you want to make runtime
> optional already in LibreOffice or is it new code you want to add ?
>
> C.
>
>


-- 
--------

Cordialement,
Siqi LIU

Étudiant Ingénieur, 1ère année
École Supérieur d'Électricité (Supélec)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20140130/fb6f7dba/attachment.html>


More information about the LibreOffice mailing list