Integration of an OPCUA Client in a dll

Questions regarding the use of the C++ SDK for Server or Client development or integration into customer products ...

Moderator: uasdkcpp

Post Reply
kobio
Full Member
Full Member
Posts: 7
Joined: 25 Jun 2014, 12:55

Integration of an OPCUA Client in a dll

Post by kobio »

Hello,
I am trying to integrate the functions of an OPCUA Client into a dll to acces data in another application.
I work with the binary Version of the UA Client SDK C++ 1.3.3. To work with the functions from the sample Client, i need to include the Header files like uaclientsdk.h or uasession.h in my Program code. The dll is created successfully and i get no Linker or Compiler Errors but with the includes, the dll isnt recognized anymore by the application.

User avatar
Support Team
Hero Member
Hero Member
Posts: 3071
Joined: 18 Mar 2011, 15:09

Re: Integration of an OPCUA Client in a dll

Post by Support Team »

Hi,

Can you provide more details on "the dll isnt recognized anymore by the application"?

If you can compile your code with the SDK headers and link the OPC UA Client SDK libraries to your DLL, the SDK should not affect the loading of your DLL into another application.

Best Regards,
Unified Automation Support Team

kobio
Full Member
Full Member
Posts: 7
Joined: 25 Jun 2014, 12:55

Re: Integration of an OPCUA Client in a dll

Post by kobio »

Hi, it is a dll that extends the functionality of a Monitoring tool for PLCs. At the Moment i am trying that the Monitoring tool can also Access data via OPCUA, for that i program a dll with the functions of an OPCUA Client.
When i open the Monitoring tool, all the extensions that are realised as dlls are shown for selection (for example a TwinCat Connection) but as soon as i include the above mentioned headers, the OPCUA Extension isnt shown anymore for selection.

User avatar
Support Team
Hero Member
Hero Member
Posts: 3071
Joined: 18 Mar 2011, 15:09

Re: Integration of an OPCUA Client in a dll

Post by Support Team »

Hi,

Do you expose data types defined by the SDK through your DLL interface to the monitoring application?
I assume not since the DLL interface must be abstract to work as a plug-in interface.

Without knowing your DLL loading mechanism we have no idea what could cause this issue.
You should debug the DLL loading mechanism.

Best Regards,
Unified Automation Support Team

kobio
Full Member
Full Member
Posts: 7
Joined: 25 Jun 2014, 12:55

Re: Integration of an OPCUA Client in a dll

Post by kobio »

Hello,
No, the Monitoring Tool does not use data types of the SDK.

By Debugging the dll Loading Mechanism I found that the dll is loaded by the function LoadLibraryW(path.c_str());
When the SDK Headers are included, i get a nullhandle back and the loading Fails because of ERROR_NOT_READY, 21 (0x15), The device is not ready.
Is there any part in the SDK that could cause this behaviour?

kobio
Full Member
Full Member
Posts: 7
Joined: 25 Jun 2014, 12:55

Re: Integration of an OPCUA Client in a dll

Post by kobio »

Hello?

User avatar
Support Team
Hero Member
Hero Member
Posts: 3071
Joined: 18 Mar 2011, 15:09

Re: Integration of an OPCUA Client in a dll

Post by Support Team »

Hi,

Can you try with the current C++ SDK version (1.4.2)?

In version 1.3.x it was necessary to initialize the UA Stack platform layer before using any classes of the SDK. Even if you used UaString as a global variable, this failed because it was initialized before the stack platform layer was initialized.

This is not longer necessary with the UA Stack used in version 1.4.x.
This is the only potential issue we can think of.

Did you try the code you integrated in the DLL in a console application?
Does it run?
Is and OPC UA code executed in your DLL loading function?
Can you debug your DLL loading function?

Best Regards,
Unified Automation Support Team

kobio
Full Member
Full Member
Posts: 7
Joined: 25 Jun 2014, 12:55

Re: Integration of an OPCUA Client in a dll

Post by kobio »

The Problem is solved now, i forgot to copy the uastack.dll, ssleay32.dll, libeay32.dll and libxml2.dll together with my dll.

Post Reply