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

TOPIC: GetExtString Compiler Warning

GetExtString Compiler Warning 1 year 4 months ago #10126

  • AutoMate
  • AutoMate's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 117
  • Thank you received: 1
  • Karma: 0
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 1 year 4 months ago #10128

  • claes
  • claes's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 2753
  • Thank you received: 371
  • Karma: 118
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: 0.432 seconds