Hi,
at the moment, I am evaluating your C++ SDK 1.3.0 Bundle UA for a client development.
I now have the following problem:
Our application uses a Win 32 DLL, developed with the help of the SDK C++ as UA client. The DLL is dynamically un-/loaded at run time.
In case of a particular event of the application, the DLL should be reloaded again.
I use the PROCESS_ATTACH / PROCESS_DETACH cases in the main function of the DLL to initialize und cleanup the toolkit (UaPlatformLayer::init() / UaPlatformLayer::cleanup()).
Before calling the cleanup function, I ensured, that all sessions are terminated and the memory of the objects has been released.
The subsequent call of the cleanup function doesn’t return – the application hangs.
In order to investigate the matter, I took your example “Getting Started / Lesson 2” and added UaPlatformLayer::cleanup () right after the disconnect call.
Here comes the call to an exception after the program ends.
Is this a bug or are there any requirements that I have not covered?
Thank you and best regards
Konrad
How to reinitialize the toolkit?
Moderator: uasdkcpp
- Support Team
- Hero Member
- Posts: 3069
- Joined: 18 Mar 2011, 15:09
Re:How to reinitialize the toolkit?
Hello Konrad,
UaPlatformLayer::init() / UaPlatformLayer::cleanup() is connecting / releasing the function pointer list between the platform independent part of the UA stack and the operating system specific part of the UA stack.
For that reason any use of a UA stack / OPC UA related class before init() or after cleanup() will cause an access violation. That includes any static members initialized during startup or released during shutdown of the process. In your special case I assume it is the UaString in the main function that causes the problem during shutdown. We do not like this limitation but it is something introduced by the UA stack and its platform layer.
To analyse your original problem we need the log file of the client API and the stack.
Can you enable logging and send the log file to support@unifiedautomation.com
You need to add the following code to the client to create the log file:
Best Regards,
Unified Automation Support Team
UaPlatformLayer::init() / UaPlatformLayer::cleanup() is connecting / releasing the function pointer list between the platform independent part of the UA stack and the operating system specific part of the UA stack.
For that reason any use of a UA stack / OPC UA related class before init() or after cleanup() will cause an access violation. That includes any static members initialized during startup or released during shutdown of the process. In your special case I assume it is the UaString in the main function that causes the problem during shutdown. We do not like this limitation but it is something introduced by the UA stack and its platform layer.
To analyse your original problem we need the log file of the client API and the stack.
Can you enable logging and send the log file to support@unifiedautomation.com
You need to add the following code to the client to create the log file:
Code: Select all
/* Activate client trace*/
LibT::initTrace( UaTrace::Data, 10000, 5, "uaclient.log", "sample client");
LibT::setTraceActive(true);
/* Set Trace Settings for stack*/
UaPlatformLayer::changeTraceSettings(OpcUa_True, OPCUA_TRACE_OUTPUT_LEVEL_ALL);
LibT::setStackTraceActive(true);
Unified Automation Support Team
Best regards
Unified Automation Support Team
Unified Automation Support Team
-
- Jr. Member
- Posts: 4
- Joined: 17 Oct 2011, 08:40
Re:How to reinitialize the toolkit?
Hi Support Team,
I sent you the log file!
Best regards
Konrad
I sent you the log file!
Best regards
Konrad
-
- Jr. Member
- Posts: 4
- Joined: 17 Oct 2011, 08:40
Re:How to reinitialize the toolkit?
Hi Support Team,
do you have any suggestions about my problem?
Best regards
Konrad
do you have any suggestions about my problem?
Best regards
Konrad
- Support Team
- Hero Member
- Posts: 3069
- Joined: 18 Mar 2011, 15:09
Re:How to reinitialize the toolkit?
Hi Konrad,
We received your log file but it does not provide enough detail why the clean up function does not return and nothing looks wrong.
We are trying to reproduce the problem with the information you provided. We will contact you if we need more input.
Best Regards,
Support Team
We received your log file but it does not provide enough detail why the clean up function does not return and nothing looks wrong.
We are trying to reproduce the problem with the information you provided. We will contact you if we need more input.
Best Regards,
Support Team
Best regards
Unified Automation Support Team
Unified Automation Support Team
-
- Jr. Member
- Posts: 4
- Joined: 17 Oct 2011, 08:40
Re:How to reinitialize the toolkit?
Hi Support Team,
according to your instructions, I removed the function calls init() & cleaup() from the DLL MAIN and implemented my own reference counter. Depending on its value, the toolkit is initialized or cleaned up.
The problem is solved - thank you very much
Best regards
Konrad
according to your instructions, I removed the function calls init() & cleaup() from the DLL MAIN and implemented my own reference counter. Depending on its value, the toolkit is initialized or cleaned up.
The problem is solved - thank you very much
Best regards
Konrad