Boost logo

Boost Users :

Subject: Re: [Boost-users] shared_ptr binary compatibility
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2009-06-11 13:59:39


On Thu, Jun 11, 2009 at 10:23 AM, pcayouette<pcayouette_at_[hidden]> wrote:
>
> Are shared_ptr binary compatible through boost versions?
>
> Example:
>
> Imagine a "Producer" class that sends shared_ptr to a "Consumer" class. Now
> imagine an executable that instanciate a Producer and a shared library (.dll
> or .so) that instanciate a Consumer. The executable is built with boost
> v1.xx. The shared library is built with boost v1.yy.
>
> If xx == yy, obviously there will be no problem since the version of the
> shared_ptr is the same.
>
> However if xx != yy, there might be a problem since the version of the
> shared_ptr might be binary imcompatible.

I don't think that there is a formal promise that shared_ptrs from
different Boost versions are compatible but in practice I think that
they are stable enough for some applications. I mean, occasionally
you'd introduce breaking changes that require shared libs to be
rebuilt anyway, right?

That said, what's wrong with defining the shared library interface in C, as in:

struct foo;
foo * create_foo();
void destroy_foo( foo * );

In the client, you can still wrap this in a shared_ptr using a custom deleter.

Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net