0

This is for a Tizen project, developed with Tizen Studio.

I have developed a library (.so) that implements several c++ classes, all which are in the same namespace. The question I have now is: how do I access a class within the lib.

A brief example:

mylibclasses.cpp:

namespace myspace{
class EXPORT_API myclass{
public:
   myclass(){};
   ~myclass(){};

   void myfunc(){};

}
}

EXPORT_API is defined by the tizen library as: __attribute__((__visibility__("default"))). (this is what Tizen Studio uses to export C funtions). I have built this (myclasses.so) successfully.

For main.cpp, I would like to do something like:

// using namespace myspace;
int main(int argc, char** argv){
   extern class myclass   c(); // this makes linker look for "myclass"
   c.foo();
}

With C, I had a header file (main.h) that had forward declarations statements for each exported function. How do I do that for c++ and classes?

EDIT: removed using namespace, since compiler doesn't know the name space; added extern class for the declaration type of myclass.

In Tizen Studio, under Project Properties->Settings->C++ Linker->Libraries, I added for "-l" <libname.so>, and for "-L" for the path to libname.so . But in the actual linker command line, the "-l<libname.so>" gets put before the "-L". The linker looks for "libname.so" (-l) before it sets the lib path (-L). So the linker never finds the libname.so. But I can't get the settings to switch this order.

Anyone experienced enough with Tizen Studio?

Enlico
  • 23,259
  • 6
  • 48
  • 102
user3182551
  • 343
  • 2
  • 9

0 Answers0