EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  2025  <2026 Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  2025  <2026
<== Date ==> <== Thread ==>

Subject: Re: another problem with multiple SNL
From: Dariush Hampai via Tech-talk <tech-talk at aps.anl.gov>
To: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Tue, 3 Feb 2026 19:49:07 +0100
Hi Mark,
thank you for your fast answer… however, the file stt starts exactly in that wat

program xena_sncscan

%{
#include <math.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <sys/stat.h>
#include <errno.h>

#define MAX_MOTORS 20
#define MAX_DETECTORS 20

FILE *detector_files[MAX_DETECTORS];
char detector_paths[MAX_DETECTORS][512];

}%


/*=================== Declarations =========================*/

option +r;

for both the two different servers… 
talking with Maurizio, to find a possible solution, the array “detector_paths” can be inserted as SNL code (as char/string detector_paths[20][512];), while how can I define the "FILE *detector_files[MAX_DETECTORS];” outside the “C” environment? It seems that the pointer in one server is in common with all the state machines and in the second server the pointers are “local” and not in common.

awaiting your reply

Dariush







************************************

Dr. Dariush Hampai, PhD

INFN - LNF
X-Lab Frascati
Via E. Fermi, 54 (ex 40)
I-00044 Frascati (RM)
Italy

Mail Address:
XLab-Frascati
LNF-INFN
Casella Postale 13
Frascati (RM)
Italy

Room: +39.06.9403.5248
Lab.: +39.06.9403.2286
Mob.: +39.06.9403.8025
Fax.: +39.06.9403.2597

************************************



Il giorno 3 feb 2026, alle ore 18:35, Mark Rivers <rivers at cars.uchicago.edu> ha scritto:

You need to add this line to the start of your state program so that global symbols do not conflict. 

option +r;

Here is a real-world example:


Mark



From: Dariush Hampai <dariush.hampai at lnf.infn.it>
Sent: Tuesday, February 3, 2026 10:36 AM
To: tech-talk at aps.anl.gov <tech-talk at aps.anl.gov>
Cc: Mark Rivers <rivers at cars.uchicago.edu>; Maurizio M. <maurizio.montis at lnl.infn.it>
Subject: another problem with multiple SNL
 
Dear Community;
I'm trying to make three different state machine (SNL) in the same IOC.
The st.cmd is
< envPaths

cd "${TOP}"

## Register all support components
dbLoadDatabase "dbd/scan.dbd"
scan_registerRecordDeviceDriver pdbbase

## Load record instances
dbLoadRecords("db/scan.db","user=xena,server=xlabsrv2")
dbLoadRecords("db/scan.db","user=rxr,server=xlabsrv2")
dbLoadRecords("db/scan.db","user=cts,server=xlabsrv2")
#dbLoadTemplate("db/scan.val","user=xlabsrv2")

cd "${TOP}/iocBoot/${IOC}"
iocInit

## Start any sequence programs
seq xena_sncscan,"user=xena,server=xlabsrv2"
seq rxr_sncscan,"user=rxr,server=xlabsrv2"
seq cts_sncscan,"user=cts,server=xlabsrv2"

so it should be run three different SNLs. In one server it works 
properly, however in a different server during the make I receive this 
error message:

/usr/bin/ld: 
rxr_sncscan.o:/home/xlabsrv2/epics/IOCs/scan/scanApp/src/O.linux-x86_64/../rxr_sncscan.stt:25:
multiple definition of `detector_files'; 
xena_sncscan.o:/home/xlabsrv2/epics/IOCs/scan/scanApp/src/O.linux-x./xena_sncscan.stt:25:
first defined here
/usr/bin/ld: 
rxr_sncscan.o:/home/xlabsrv2/epics/IOCs/scan/scanApp/src/O.linux-x86_64/../rxr_sncscan.stt:26:
multiple definition of `detector_paths'; 
xena_sncscan.o:/home/xlabsrv2/epics/IOCs/scan/scanApp/src/O.linux-x./xena_sncscan.stt:26:
first defined here
/usr/bin/ld: 
cts_sncscan.o:/home/xlabsrv2/epics/IOCs/scan/scanApp/src/O.linux-x86_64/../cts_sncscan.stt:25:
multiple definition of `detector_files'; 
xena_sncscan.o:/home/xlabsrv2/epics/IOCs/scan/scanApp/src/O.linux-x./xena_sncscan.stt:25:
first defined here
/usr/bin/ld: 
cts_sncscan.o:/home/xlabsrv2/epics/IOCs/scan/scanApp/src/O.linux-x86_64/../cts_sncscan.stt:26:
multiple definition of `detector_paths'; 
xena_sncscan.o:/home/xlabsrv2/epics/IOCs/scan/scanApp/src/O.linux-x./xena_sncscan.stt:26:
first defined here

the versions of the two servers are absolutely equal (I copied the 
version from one to another), however in one server I have this error...
What am i wrong?
Thank you in advance

Dariush

-- 
************************************

Dr. Dariush Hampai, PhD

INFN - LNF
X-Lab Frascati
Via E. Fermi, 54 (ex 40)
I-00044 Frascati (RM)
Italy

Mail Address:
XLab-Frascati
LNF-INFN
Casella Postale 13
Frascati (RM)
Italy

Room:   +39.06.9403.5248
Lab.:   +39.06.9403.2286
Mob.:   +39.06.9403.8025
Fax.:   +39.06.9403.2597

************************************


Replies:
Re: another problem with multiple SNL Dariush Hampai via Tech-talk
References:
another problem with multiple SNL Dariush Hampai via Tech-talk
Re: another problem with multiple SNL Mark Rivers via Tech-talk

Navigate by Date:
Prev: Re: [External] Re: MODBUS User-Defined Function Codes Mark Rivers via Tech-talk
Next: Re: another problem with multiple SNL Dariush Hampai via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  2025  <2026
Navigate by Thread:
Prev: Re: another problem with multiple SNL Mark Rivers via Tech-talk
Next: Re: another problem with multiple SNL Dariush Hampai via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  2025  <2026
ANJ, 19 Mar 2026 · Home · News · About · Talk · Base · Modules · Extensions ·
· Distributions · Download · Documents · Links · Licensing ·