I have used gsoap generated files as components of a .dll project where in the .dll entry section I used the following:
int __stdcall DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
/* create a soap environment (provides soap services) */
soap = soap_new();
break;
case DLL_PROCESS_DETACH:
/* terminate soap services */
soap_end(soap); //discontinue soap services
soap_free(soap); //free soap resources
break;
}
/* Return 1 to indicate successful initialization */
return 1;
}
This approach results in no memory leaks for me. You could possible use an adaptation of something like this within your c++code, could you not?