S
SoofaLoofa
Hi,
I am working on a large software project where we need to program for
two identical devices. Let's call them A and B. We have already
coded all of the functionality of A and created a shared library out
of this code that we can call libA.so. To support device B we re-
compile this code and create a second shared library: libB.so. Now we
have two shared libraries that can control their respective devices
independently.
The problem that we are having is that it would be advantageous in
certain cases to access either or both devices from the same piece of
code. However, since libA and libB have identical method names how
can we link these to the same code to access them? I'd like to create
a wrapper class that gives access to both shared libraries. Ideally,
the functionality of the wrapper would give global access to the
libraries through an array index so that if I make a call like lib[0]-
into the lib array could vary at run-time.
Any suggestions on this or design ideas that might work? Can this
work at all?
Kevin
I am working on a large software project where we need to program for
two identical devices. Let's call them A and B. We have already
coded all of the functionality of A and created a shared library out
of this code that we can call libA.so. To support device B we re-
compile this code and create a second shared library: libB.so. Now we
have two shared libraries that can control their respective devices
independently.
The problem that we are having is that it would be advantageous in
certain cases to access either or both devices from the same piece of
code. However, since libA and libB have identical method names how
can we link these to the same code to access them? I'd like to create
a wrapper class that gives access to both shared libraries. Ideally,
the functionality of the wrapper would give global access to the
libraries through an array index so that if I make a call like lib[0]-
lib[1]->GetDeviceType(); it would link to libB. Of course the indexGetDeviceType(); it would link to libA and if I make a call like
into the lib array could vary at run-time.
Any suggestions on this or design ideas that might work? Can this
work at all?
Kevin