Edit xml resource, Other considerations, Pass tags by reference – Rockwell Automation 1789-L10_L30_L60 SoftLogix 5800 System User Manual User Manual

Page 146: External routine dll that uses other dlls

Advertising
background image

146

Rockwell Automation Publication 1789-UM002J-EN-P - December 2012

Chapter 7

Develop External Routines

Edit XML Resource

Change the <EntryPoint> tag to be the decorated name (found when you ran
dumpbin.exe). The XML EntryPoint name must EXACTLY match the
decorated named displayed by the dumpbin.exe utility.

<?xml version="1.0" encoding="UTF-8"?>
<RA_ExternalRoutines_XML>
<Description>Sum array elements.</Description>
<Routines>

<Routine>

<EntryPoint>?SumArray@@YAHPAUEXT_ROUTINE_CONTROL@@QAH@Z</EntryPoint>
<Description>Sum integer array elements</Description>
<Signature>int SumArray(EXT_ROUTINE_CONTROL* pERCtrl,

int Val[])</Signature>

</Routine>

</Routines>
</RA_ExternalRoutines_XML>

Other Considerations

Consider these suggestions for your external routines.

Pass Tags by Reference

You can pass tags by reference in a synchronous, single-threaded routine. You
should not pass these memory addresses to another thread or process because it is
possible for the originating tag to be deleted. Then, the reference to the
originating tag in the thread or process becomes invalid and causes an
access violation.

External Routine DLL that Uses Other DLLs

If you create an external routine DLL that uses other DLLs, make sure that the
additional DLL files are accessible to the SoftLogix engine at runtime. For
example, assume external routine MyER.DLL uses another file called
MyAdditionalFile.DLL. RSLogix 5000 software copies MyER.DLL into the
project area and downloads MyER.DLL to the appropriate controller slot during
download. However, RSLogix 5000 software does not copy or download
MyAdditionalFile.DLL.

To make MyAdditionalFile.DLL available on the target machine, put the
MyAdditionalFile.DLL file into the Windows system32 directory on the target
machine. This makes sure that the file is available when needed. Otherwise, when
the controller attempts to perform the Windows LoadLibrary call for
MyER.DLL it will fail because the MyAdditionalFile.DLL cannot be found.

As a better solution, statically link any additional DLL files that are needed right
into the external routine DLL. This leaves only one file and RSLogix 5000
software takes care of copying the DLL to the correct places.

Advertising