THttpServer application in compiled code

I compiled and run the following code.
But, I can not call the function from the web browser because of scope error.
Do you know how to register the function as the command ?

#include <TH1.h>
#include <THttpServer.h>
#include <TRandom3.h>

bool LoopFlag = true;

void ExitFunc(void){
        LoopFlag = false;
}

int main(int argn, char* argv[]) {

	THttpServer* serv = new THttpServer("http:8080?top=Test");
	serv->RegisterCommand("/Exit","ExitFunc()");

	int i = 0;
	TRandom3 random;
	TH1F *hist = new TH1F("hist", "hist", 1000, 0, 1);

	while (LoopFlag) {
		double rnd = random.Rndm(1);
		hist->Fill(rnd);
		if ((i % 1000000) == 0) {
			serv->ProcessRequests();
		}
		i++;
	}

	return 0;
}

Thanks.

Hi,

If I put similar code in named macro and run it with compiled mode, it works.
Like running macro from tutorials:

[shell] root -l httpcontrol.C+

If you compile and link application yourself, probably you need to create dictionary and put function declaration there.

Regards,
Sergey

Dear Sergey,

Thank you for your advice.

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