[ovs-discuss] Problem with VLOG module init

Ahmed Talha Khan auny87 at gmail.com
Wed Dec 5 18:46:17 UTC 2012

Its Linux with kernel 2.6.35 on Fedora 14 x86_64 machine. And yes thats
what I though too that only VLOG_DEFINE_THIS_MODULE should do the job as it
creates and the actual module as well as the reference.

I see that it is defined like this

#define VLOG_DEFINE_THIS_MODULE(MODULE)                                 \
        VLOG_DEFINE_MODULE(MODULE);                                     \
        static struct vlog_module *const THIS_MODULE = &VLM_##MODULE

The 2nd line to create a reference works as its not a compile issue. The
linker cries which means that VLOG_DEFINE_MODULE(MODULE) failed to create
the module in the linker section as given by

#define VLOG_DEFINE_MODULE(MODULE)                                      \
        VLOG_DEFINE_MODULE__(MODULE)                                    \
        extern struct vlog_module *vlog_module_ptr_##MODULE;            \
        struct vlog_module *vlog_module_ptr_##MODULE                    \
            __attribute__((section("vlog_modules"))) = &VLM_##MODULE

Any ideas now what might have happened? Could be it some sort of a version
mis-match for the GNU linker "ld"?

On Wed, Dec 5, 2012 at 8:35 PM, Ben Pfaff <blp at nicira.com> wrote:

> On Wed, Dec 05, 2012 at 12:29:51PM +0500, Ahmed Talha Khan wrote:
> > I am trying to register one of my own modules for logging purpose but it
> > does not seem to work.
> >
> > In my source file xyz.c included
> >
> >
> > and then later in the file i use
> >
> > VLOG_INFO("some msg printed here")
> >
> > But when I run make, the linker cries:
> >
> > undefined reference to `VLM_xyz'.
> >
> > What am I missing here. Isnt this suppose to be a simple operation?
> Yes, all you should need is the VLOG_DEFINE_THIS_MODULE line.
> What kind of system are you using?

-Ahmed Talha Khan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openvswitch.org/pipermail/ovs-discuss/attachments/20121205/b8ee91ca/attachment.html>

More information about the discuss mailing list