Using H323Plus in a class library
Posted: Thu Dec 23, 2021 12:38 am
Hello,
I am working on a VC++ wrapper for H323Plus (based on compiled H323Plus.lib and ptlibs.lib). There will be a C# executable that references the wrapper DLL to use H323Plus features. Before I go much further I would like to understand the function of the PProcess and PCREATE_PROCESS. There is some internal initialization happening, but this is basically what I have so far:
PCREATE_PROCESS(BaseProcess);
/* This is what PCREATE_PROCESS is doing
int main(int argc, char **argv, char **envp)
{
BaseProcess *pinstance = new BaseProcess();
pinstance->PreInitialise(argc,argv,envp);
int terminationValue = pinstance->InternalMain();
delete pinstance;
return terminationValue;
}
*/
BaseProcess::BaseProcess()
: PProcess("H323Plus", "Wrapper", MAJOR_VERSION, MINOR_VERSION, BUILD_TYPE, BUILD_NUMBER, true)
{
endpointp = NULL;
}
BaseProcess::~BaseProcess()
{}
Notice the last parameter in the PProcess arguments of "true". From what I gather, this is supposed to indicate that the process is used in a library versus an executable. I've made a comment block which shows what the PCREATE_PROCESS expands to. Basically, I am not sure how to use this PProcess object in a class library. What I would like to do is create the process instance as shown in this block, but create it when I instantiate my H323 wrapper class from the C# module. In examples I have seen, the main routine for the Process is setting up a loop or a terminationSync.Wait(). Is it required to have a process with a continually running thread (the main() routine)? I know that a Process instance is needed, as some methods are looking for Process::Current(). Looking for some guidance on how to implement this in a class library vs. directly in an executable.
David
I am working on a VC++ wrapper for H323Plus (based on compiled H323Plus.lib and ptlibs.lib). There will be a C# executable that references the wrapper DLL to use H323Plus features. Before I go much further I would like to understand the function of the PProcess and PCREATE_PROCESS. There is some internal initialization happening, but this is basically what I have so far:
PCREATE_PROCESS(BaseProcess);
/* This is what PCREATE_PROCESS is doing
int main(int argc, char **argv, char **envp)
{
BaseProcess *pinstance = new BaseProcess();
pinstance->PreInitialise(argc,argv,envp);
int terminationValue = pinstance->InternalMain();
delete pinstance;
return terminationValue;
}
*/
BaseProcess::BaseProcess()
: PProcess("H323Plus", "Wrapper", MAJOR_VERSION, MINOR_VERSION, BUILD_TYPE, BUILD_NUMBER, true)
{
endpointp = NULL;
}
BaseProcess::~BaseProcess()
{}
Notice the last parameter in the PProcess arguments of "true". From what I gather, this is supposed to indicate that the process is used in a library versus an executable. I've made a comment block which shows what the PCREATE_PROCESS expands to. Basically, I am not sure how to use this PProcess object in a class library. What I would like to do is create the process instance as shown in this block, but create it when I instantiate my H323 wrapper class from the C# module. In examples I have seen, the main routine for the Process is setting up a loop or a terminationSync.Wait(). Is it required to have a process with a continually running thread (the main() routine)? I know that a Process instance is needed, as some methods are looking for Process::Current(). Looking for some guidance on how to implement this in a class library vs. directly in an executable.
David