Hi,
recently I faced a warning in a document what tells me:
Zitat:
Plaese note, string functions are not "thread safe": When using tasks, string functions may only be used in a single task. If the same function is used in different tasks, there is a danger of overwriting.
Okay, clear so far. It is like it is. I am looking for a general solution how to deal with this restriction in POUs provided in libraries.
Do you recommend to use in general the functions from the StringUtils.library?
For my opinion the usage of this lib in my situation brings me two advantages:
I avoid the use of the STRING functions from the Standard lib, thus there is no risk in conjunction with MultiTask apps where my POUs are implemented later.
The program becomes more performant.
Maybe it sounds a little bit stupid, because I answered teh question by myself. But I am really looking for an external opinion to strengthen my decision, not to use the String functions from the Standard lib in my libraries.
Thank you for your feedback.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I got the information from 3S that since CoDeSys V3 all String functions are threadsafe. Thus the problem has been solved by itself.
However, I also got the information, it is recommended to use the StringUtils lib, because it is more performant than the functions from the Standard lib.
Regards
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I want to use the StuSprintf function from this library to format real value to string send in a Text file.
I search in my Library manager but could not find the StringUtils in the list.
I tried to add it without results but this library is visible in my codesys library repository under the system folder.
So i thought: As it is a system library, perhaps it is implicitly included...
When I add the function StuSprintf in my CFC code, the bloc interface is displayed correctly and I can configure the input & output.
But StuSprintf stay red underlined with a warning saying Indentifier 'StuSprintf' not defined. How to solve this?
I am working with codesys V3.5 SP16 patch4 and my Target device Codesys Control for Raspberry Pi MC SL.
Thanks for any help
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is there a C equivalent function in Codesys for string formatting?
For example: sprintf(str, "%d,%d,%d", a, b, c);
more posts ...
Originally created by: scott_cunningham
You have to build the string. See CONCAT and associated key words
I am familiar with CONCAT but I am seeking for more elegant solution for longer strings. Also, CONCAT is rather slow.
Originally created by: scott_cunningham
I also don't use CONCAT. I use my own byte copy routine. Sorry, IEC isn't setup to have fancy string handlers.
Hi,
in any case it is much more performant if you use StringUtils.library in compare to use the string/concat whatever from Standard library.
BR
Edwin
Hi,
recently I faced a warning in a document what tells me:
Okay, clear so far. It is like it is. I am looking for a general solution how to deal with this restriction in POUs provided in libraries.
Do you recommend to use in general the functions from the StringUtils.library?
For my opinion the usage of this lib in my situation brings me two advantages:
I avoid the use of the STRING functions from the Standard lib, thus there is no risk in conjunction with MultiTask apps where my POUs are implemented later.
The program becomes more performant.
Maybe it sounds a little bit stupid, because I answered teh question by myself. But I am really looking for an external opinion to strengthen my decision, not to use the String functions from the Standard lib in my libraries.
Thank you for your feedback.
Hi,
I got the information from 3S that since CoDeSys V3 all String functions are threadsafe. Thus the problem has been solved by itself.
However, I also got the information, it is recommended to use the StringUtils lib, because it is more performant than the functions from the Standard lib.
Regards
Hello,
I want to use the StuSprintf function from this library to format real value to string send in a Text file.
I search in my Library manager but could not find the StringUtils in the list.
I tried to add it without results but this library is visible in my codesys library repository under the system folder.
So i thought: As it is a system library, perhaps it is implicitly included...
When I add the function StuSprintf in my CFC code, the bloc interface is displayed correctly and I can configure the input & output.
But StuSprintf stay red underlined with a warning saying Indentifier 'StuSprintf' not defined. How to solve this?
I am working with codesys V3.5 SP16 patch4 and my Target device Codesys Control for Raspberry Pi MC SL.
Thanks for any help
OK i finally found the way to add it to my application