[C++-sig] Boost python simple interfacing
Giuseppe Corbelli
giuseppe.corbelli at copanitalia.com
Fri Sep 27 12:39:46 CEST 2013
On 25/09/2013 22:06, Kassiopi Kassiopi2 wrote:
> Hi,
>
> I apologize for the delayed reply.
>
> I was hoping to avoid linking the commandManager into the .so file. I am
> trying to avoid that because then, I will have to do this for any other module
> that I create and uses the commandManager. I would prefer to declare it as
> extern or something similar if possible. If I link it into to .so, then I will
> have to link it to all the modules I intend to create, separately. Moreover,
> the commandManager is statically linked into my executable, so linking it in
> every single python module, feels like overkill.
> Furthermore, since my call to the commandManager looks like:
>
> GetCommandManager()->submitCommand( new newDocumentCommand(makeActive) );
>
> I will have to also link against the commands that will be sent to the
> commandManager as well. And if there are hundreds of commands, it's obvious
> that there is a lot of redundant stuff, since all these classes are also
> declared, defined and statically linked in the executable of my application.
Well, the .so needs to have access to the GetCommandManager symbol, so I see
no way out here. Besides it also needs to create newDocumentCommand instances,
so it must have access to the constructor, too.
If command manager is something like a singleton make sure you're getting the
same object in the C++ app and in the .so. Just declaring it static here and
there doesn't work.
In theory you could also have a static python library without module support,
and link everything static. I just don't know how much work would it take.
--
Giuseppe Corbelli
WASP Software Engineer, Copan Italia S.p.A
Phone: +390303666318 Fax: +390302659932
E-mail: giuseppe.corbelli at copanitalia.com
More information about the Cplusplus-sig
mailing list