$(DICTIONARY): $(HEADERS) " Making dictionary for -f -c " Cleaning -f -f -f -f *rdict.pcmĪnd finally the macro where library is used: #include "MyEvt. $(TARGET_LIB): $(SOURCES) " Building $(CXXFLAGS) -shared -O3 -o $^ $(LDFLAGS) SOURCES = $(filter-out $(CURDIR)/app.C, $(wildcard $(CURDIR)/*.C)) These are available in most of high level languages but not in C. For more information, see, Macros and C++. The define directive and The undef directive discuss the define and undef directives, respectively. Once you've removed the definition, you can redefine the macro to a different value. For example, we can create loops like foreach which are very useful and handy when it comes to arrays. The undef directive removes the definition of a macro. HEADERS = $(filter-out $(CURDIR)/LinkDef.h, $(wildcard $(CURDIR)/*.h)) Using C Macros, we can extend C with a lot of useful functionality. In this macro guide I explain every macro that I use and why I use them. ROOTCFLAGS = $(shell root-config -cflags) This is a beginners guide to WotLK Hunter Macros. LinkDef.h def and Makefile: #ifdef _CINT_ Hence, why is there different behavior, although I load the shared library inside the macro with ‘gSystem->Load(“libexample.so”)’? How do I need to change the Makefile, such that running with ‘root app.C++’ would work? #ifndef MyEvt_h To re-produce the problem, put all of these file to a single directory and run make to compile the shared library libexample.so.Įverything works nicely. In a C program, all lines that start with are processed by preprocessor which is a special program invoked by the compiler. I would like to compile the class into a shared library object (in reality I will have more classes in the shared library) and load the shared library in a compiled macro for usage.īelow are the source codes of five files: MyEvt.h, MyEvt.C, LinkDef.h, Makefile, app.C, also attached as a tar ball example.tar (10 KB) Interesting Facts about Macros and Preprocessors in C. I have a minimalistic event class that I would eventually like to write to a TTree.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |