About MyClass And SharedLibrary Question

Sorry It tell me I can’t put links in posts But I don’t put links
So I use picture
Sorry for the inconvenience

May be @pcanal can help you.

Look forward to the guidance of the boss :smile: :smile: :smile: :smile: :smile: :smile:

my root version is 6.26 :smile:

You do need to generate a dictionary for both your class ndet and its vector std::vector<ndet>.
To do so you need create a header file, let’s call it ndet.h

#pragma once
#include <vector>

struct ndet {
  Short_t det;
  Short_t id;
  Double_t e;
  Long_64_t ts;
};

and an linkdef file, let’s call it ndet_LinkDef.h:

#pragma link C++ class ndet+;
#pragma link C++ class std::vector<ndet>+;

And generated the dictionary source file:

rootcling -f ndet_dict.cxx ndet.h ndet_LinkDef.h

and then compile that file into ndet_dict.o which you can send directly link into your executable or bundle into a library, eg:

c++ -fPIC --shared `root-config --cflags --libs` libndet.so ndet_dict.cxx

Cheers,
Philippe.

Thank you very much ! :laughing: :laughing:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.