Hi Andrew,
Thank you for this clarification.
Initially I wanted to configure a gensub input as a string with number
of element >=2 (string array input),
and initialize it with MACRO substitution.
I understand this is not possible because a string is considered as a
CA_LINK.
But can you still answer the following questions:
- is it possible to initialize an array with a MACRO (be it numeric or
string) ?
- is it possible to initialize a string array from the startup script
using dbpf command or else ?
regards.
Andrew Johnson a écrit :
Hi Christophe,
On Tuesday 27 October 2009 05:50:55 haquin wrote:
I looked in the genSub record code and I think that what I do should
work
... After deeper investigations, it turns out that when I initialize
the
INPH field type with FTH=STRING or CHAR it is then assigned a
CA_LINK type
((*plinkin).type)==CA_LINK instead of CONSTANT ... That's why the
Constant
string is not copied at init.
When FTH=LONG then ((*plinkin).type)==CONSTANT
How can I force it to be a CONSTANT
You can't; with the existing database code the link type will be
CONSTANT only if the INPH string is a number. This behavior is a
fundamental feature of the way in which we parse link strings: If the
string is completely consumed by strtod() or strtol() the link type
is a CONSTANT; if not and it matches the name of a local PV it's a
DB_LINK, otherwise it must be a CA_LINK.
As an alternative to Tim's suggestion you could put one or more dbpf
commands in your startup script to set the .H field with your
string(s), but they must appear after the iocInit command.
Sorry,
- Andrew