13.6. Linking With the Massiv Demo

The library we have created depends only on the Core and can be linked to any Massiv application. For example, to link it to the Massiv Demo, modify it following these steps:

  1. Modify src/demo/lib/server/idl.list, which is the main IDL list of the Massiv Demo server node application. Add line containing depends ../../../example/server_lib, which ensures that the example managed classes will be included in the class list of the Massiv Demo server.

  2. Add a line containing libs += ../../example/server_lib/example_server_lib to the program demo_server section of file src/demo/server/makefile.gen to link the Massiv Demo server with the example library.

Then you can either directly instantiate and use objects of the Hello class from other objects, or create the Hello object and register it to the naming service (from the code or on the console of the Massiv Demo), and then use it from anywhere like this:

#include "database/well_known_object_id_database.h"
#include "lib/server/naming_service.h"
#include "example/server_lib/hello_interface.h"

...
const ObjectId naming_id = Global::well_known_object_id_database().
    get_naming_service_object();
const Remote< Demo::Lib::NamingService > naming( naming_id );
Remote< example::HelloInterface > hello( naming->sync_get_object( "hello" ) ).convert();
const std::string result = hello->sync_hello( "callee" );