Difference between revisions of "First experiences using QuickOPC with Free Pascal (Lazarus)"

From OPC Labs Knowledge Base
Jump to navigation Jump to search
Line 1: Line 1:
 
[[Category:COM]] [[Category:Free Pascal]] [[Category:Lazarus]]  
 
[[Category:COM]] [[Category:Free Pascal]] [[Category:Lazarus]]  
  
Performed with in-works QuickOPC version 2016.2 (5.41), and Lazarus installation package '''lazarus-1.6.0-fpc-3.0.0-win64.exe''', on Windows 7 (x64).
+
Performed with in-the-works QuickOPC version 2016.2 (5.41), and Lazarus installation package '''lazarus-1.6.0-fpc-3.0.0-win64.exe''', on Windows 7 (x64).
  
 
In order to use the COM type libraries of QuickOPC, it is needed to install the '''LazActiveX''' package  (comes with Lazarus). See http://wiki.freepascal.org/LazActiveX for details and instructions. Package -> Install/Uninstall Packages ..., select LazActiveX 0.1 under "Available for installation", press "Install selection", press "Save and rebuild IDE".
 
In order to use the COM type libraries of QuickOPC, it is needed to install the '''LazActiveX''' package  (comes with Lazarus). See http://wiki.freepascal.org/LazActiveX for details and instructions. Package -> Install/Uninstall Packages ..., select LazActiveX 0.1 under "Available for installation", press "Install selection", press "Save and rebuild IDE".
Line 12: Line 12:
  
 
Argument name '''sender''' used in QuickOPC COM event sink interfaces had conflicted with the additional '''Sender''' argument generated by Free Pascal type library importer. We have resolved this by renaming our arguments to '''aSender'''.
 
Argument name '''sender''' used in QuickOPC COM event sink interfaces had conflicted with the additional '''Sender''' argument generated by Free Pascal type library importer. We have resolved this by renaming our arguments to '''aSender'''.
 +
 +
Getting error below - currently stuck on it:
 +
 +
<pre>
 +
opclabs_easyopcua_5_41_tlb.pas(8917,13) Error: Incompatible types: got "TEvsEasyUAClientConfiguration.EventSinkInvoke(TObject;LongInt;const TGuid;LongInt;Word;tagDISPPARAMS;_Pointer;_Pointer;_Pointer);" expected "<procedure variable type of procedure(TObject;LongInt;const TGuid;LongInt;Word;tagDISPPARAMS;Pointer;Pointer;Pointer) of object;Register>"
 +
</pre>
  
 
Related links:
 
Related links:

Revision as of 19:08, 24 September 2016


Performed with in-the-works QuickOPC version 2016.2 (5.41), and Lazarus installation package lazarus-1.6.0-fpc-3.0.0-win64.exe, on Windows 7 (x64).

In order to use the COM type libraries of QuickOPC, it is needed to install the LazActiveX package (comes with Lazarus). See http://wiki.freepascal.org/LazActiveX for details and instructions. Package -> Install/Uninstall Packages ..., select LazActiveX 0.1 under "Available for installation", press "Install selection", press "Save and rebuild IDE".

Then, use the procedures described on the LazActiveX page under TActiveXContainer early binding. Tools -> Import Type Library, select tab "ActiveX References", type "OPC Labs" into the Search box, select one of our libraries, check "Convert dependant typelibs", press OK. The detection of "dependant" libraries does not fully work, though - for example, OpcLabs.Baselib (OPC Labs Core Library) is not imported (the comment in the generated file says that it was not registered), therefore it is necessary to import some of the "dependant" libraries manually.

There appears to be a problem with mscorlib import, its compilation resulting in errors like "mscorlib_2_4_tlb.pas(5108,16) Error: Type "Byte" is not completely defined". Work around this by commenting out the declarations of PByte, Byte, PDouble, Double, PInt64, Int64, PSingle and Single.

There appears to be a problem with BaseLib import, an incomplete Const declaration for EmptyEnumeration is being generated. Work around this by commenting out the extra Const line.

Argument name sender used in QuickOPC COM event sink interfaces had conflicted with the additional Sender argument generated by Free Pascal type library importer. We have resolved this by renaming our arguments to aSender.

Getting error below - currently stuck on it:

opclabs_easyopcua_5_41_tlb.pas(8917,13) Error: Incompatible types: got "TEvsEasyUAClientConfiguration.EventSinkInvoke(TObject;LongInt;const TGuid;LongInt;Word;tagDISPPARAMS;_Pointer;_Pointer;_Pointer);" expected "<procedure variable type of procedure(TObject;LongInt;const TGuid;LongInt;Word;tagDISPPARAMS;Pointer;Pointer;Pointer) of object;Register>"

Related links: