Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: GetExtString Compiler Warning

GetExtString Compiler Warning 5 years 3 months ago #10126

  • AutoMate
  • AutoMate's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 159
  • Thank you received: 5
  • Karma: 1
Hi Claes,

When using GetExtString in version 5.5, a compiler warning is issued (see attached). The warning concerns strncpy incompatible pointer type [ Wincompatible-pointer-types]. Our external strings being read are null terminated. If this warning is ignored, the PLC program works correctly.

Any suggestions?

Regards,
Ron
Attachments:
The administrator has disabled public write access.

GetExtString Compiler Warning 5 years 3 months ago #10128

  • claes
  • claes's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 3176
  • Thank you received: 501
  • Karma: 133
Hi Ron,

To get rid of the warning, edit src/lib/rt/src/rt_plc_macro_io.h and change the GetExtString macro:

strncpy(obj->ActVal, obj->ExtP, sizeof(pwr_tString80)); ->
strncpy(obj->ActVal, (char *)obj->ExtP, sizeof(pwr_tString80));

/Claes
The administrator has disabled public write access.
The following user(s) said Thank You: AutoMate
  • Page:
  • 1
Time to create page: 8.076 seconds