Message ID | 20181130110737.18947-1-kieran.bingham@ideasonboard.com |
---|---|
State | Accepted |
Commit | b99da21657d4f6bad415a87b82ac0d9c738018e7 |
Headers | show |
Series |
|
Related | show |
Hi Kieran, Thank you for the patch. On Friday, 30 November 2018 13:07:37 EET Kieran Bingham wrote: > The (dummy) init_lib function was linking correctly only due to a > namespace 'collision' adding the init_lib to libcamera namespace, which > is 'shared' by class libcamera. > > The init function was designed to be a class member function of the > libcamera object - and is used as such in the existing test function. > > Instead of relying on the namespace collision - update the lib/main.cpp > example file to correctly utilise the class header - and specify the > function declaration, so that further implementations do not fall into > the same bad habits. > > Reported-by: Jacopo Mondi <jacopo@mondi.org> > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> This looks good to me, feel free to merge with Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> even if the code will go away very soon. > --- > lib/main.cpp | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/lib/main.cpp b/lib/main.cpp > index 7b3da269f695..37f1ccce43cc 100644 > --- a/lib/main.cpp > +++ b/lib/main.cpp > @@ -1,13 +1,10 @@ > #include <iostream> > - > -namespace libcamera { > +#include <libcamera/libcamera.h> > > using std::cout; > using std::endl; > > -void init_lib(void) > +void libcamera::init_lib(void) > { > cout << "Lib Camera Init" << endl; > } > - > -};
diff --git a/lib/main.cpp b/lib/main.cpp index 7b3da269f695..37f1ccce43cc 100644 --- a/lib/main.cpp +++ b/lib/main.cpp @@ -1,13 +1,10 @@ #include <iostream> - -namespace libcamera { +#include <libcamera/libcamera.h> using std::cout; using std::endl; -void init_lib(void) +void libcamera::init_lib(void) { cout << "Lib Camera Init" << endl; } - -};
The (dummy) init_lib function was linking correctly only due to a namespace 'collision' adding the init_lib to libcamera namespace, which is 'shared' by class libcamera. The init function was designed to be a class member function of the libcamera object - and is used as such in the existing test function. Instead of relying on the namespace collision - update the lib/main.cpp example file to correctly utilise the class header - and specify the function declaration, so that further implementations do not fall into the same bad habits. Reported-by: Jacopo Mondi <jacopo@mondi.org> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> --- lib/main.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)