On 7/26/22 16:53, Wang, Andrew via Tech-talk wrote:
> Update. I think I got it. I had to do the following.
>
> static long func(aSubRecord *prec)
>
> {
>
> DBLINK inpa = prec->inpa;
Be aware that 'inpa.value' is a C union.
So it is strongly recommended to test 'prec->inp.type' before accessing.
In this case you are assuming that 'prec->inp.type==DB_LINK'.
> char *rec_name = inpa.value.pv_link.pvname;
>
> printf(“Record name in INPA is %s\n”, rec_name);
Also, what motivates this? Have you found an operation that
isn't covered by the link abstraction?
> return 0;
>
> }
>
>
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> *From:* Wang, Andrew
> *Sent:* Tuesday, July 26, 2022 4:17 PM
> *To:* EPICS tech-talk <tech-talk at aps.anl.gov>
> *Subject:* Retrieving record name from aSub input/output fields
>
> Hi all,
>
> Quick question this time. I was wondering if there was a way to retrieve the name of the record referenced in an OUTLINK/INLINK field such as INPA, OUTA, etc. in the aSub routine.
>
> For instance, suppose I had an aSub record such as the following.
>
> record(aSub, “example”)
>
> {
>
> field(SNAM, “func”)
>
> field(INPA, “rec_in_inpa”)
>
> }
>
> I would like to be able to print the name of the record in INPA within “func”.
>
> static long func(aSubRecord *prec)
>
> {
>
> char *rec_name = prec->____;
>
> printf(“Record name in INPA is %s\n”, rec_name);
>
> return 0;
>
> }
>
> Thanks,
>
> Andy
>
> Purple ribbon awareness <
https://urldefense.us/v3/__https://www.disabled-world.com/disability/awareness/ribbons.php*purple__;Iw!!G2kpM7uM-TzIFchu!inuIyxNM2XJXWKnvIjTejbSyl70ULfXoS2SJBJ1rrGgMtiBGic7GoQpea6to21OpaNc$ >
>