Mailing List Archive

A portable way to determine the version of libclamav
Hi list,

does anybody know of a portable way to determine the version of
libclamav? I'd like to link against it on different platforms that use
different versions of library in their application repositories. That
means I have to support the old (e.g. v0.94) and the new (e.g. 0.95.2)
interface.

From my perspective, best would be to have version information in
clamav.h and then use #ifdef's to distinguish between the different
APIs. Unfortunately, clamav.h seems not to contain such info.

I've searched a bit how other projects to it - without success. I am
sure there is a way. Could somebody please point me to it?

Thanks alot.

Tillmann
_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net
Re: A portable way to determine the version of libclamav [ In reply to ]
On 2009-09-20 13:15, Tillmann Werner wrote:
> Hi list,
>
> does anybody know of a portable way to determine the version of
> libclamav? I'd like to link against it on different platforms that use
> different versions of library in their application repositories. That
> means I have to support the old (e.g. v0.94) and the new (e.g. 0.95.2)
> interface.
>
> From my perspective, best would be to have version information in
> clamav.h and then use #ifdef's to distinguish between the different
> APIs. Unfortunately, clamav.h seems not to contain such info.
>
> I've searched a bit how other projects to it - without success. I am
> sure there is a way. Could somebody please point me to it?
>
>

You could use one of the macros that are defined in 0.95 and not in
0.94, such as CL_INIT_DEFAULT.

#ifdef CL_INIT_DEFAULT
// ... code for 0.95+ API
#else
// .. code for <0.95 API
#endif

And if you use cl_init for 0.95+ API (as you should), then if there is a
mismatch between the headers and the library (for example 0.95 headers
and 0.94 libraries), then you'll get a linker error about cl_init not
being defined.

Best regards,
--Edwin
_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net
Re: A portable way to determine the version of libclamav [ In reply to ]
> You could use one of the macros that are defined in 0.95 and not in
> 0.94, such as CL_INIT_DEFAULT.

That should do it, thanks alot.

Tillmann
_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net