Independent Module: How to insert different Procedure Files
LausX
I try to write an Independent Module which consist of different procedure files which include each other. Everytime I try to compilate I get the following error massage: "Name already exist as a function". I think due to the fact that different procedure files include each other, Igor see the same function many times but I don't know how to avoid this.
Do you have any suggestions?
Thanks a lot in advance,
P.S. Is it try that the Nidaq MX Tools are not threadsafe? I cannot find this information anymore
There aren't enough details in your description of the problem.
Try sending the experiment and procedures to support@wavemetrics.com.
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
November 27, 2013 at 01:04 pm - Permalink
* Perhaps your modules call other modules recursively. In other words, do you have this ...
#include "myprocedure1"
...
// procedure1
#include "mainprocedure"
* Perhaps your function names are not properly "protected". See this link for information. http://www.igorexchange.com/node/1688
In general, you are better to avoid Independent Modules until you really understand their caveats.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
November 28, 2013 at 06:59 am - Permalink
The flaw is (which will be fixed in Igor 6.34) that Igor was not recognizing that an #include of a procedure file that was already open and already contained
#pragma IndependentModule=someIM
did not need to be adopted into the experiment again, and thus two copies of the same procedure were loaded (one opened directly, the other erroneously adopted and another#pragma IndependentModule=someIM
statement inserted into the adopted procedure.For example, put these two procedure files into User Procedures, and drag them into/onto Igor to open them directly:
A.ipf
#pragma IndependentModule=myIM
#include "B"
Function FunctionInA()
End
B.ipf
#pragma IndependentModule=myIM
#include "A"
Function FunctionInB()
End
Click Compile and Igor will complain about duplicate FunctionInA or FunctionInB.
Execute
SetIgorOption IndependentModuleDev=1
and click the Windows->Procedures menu and see that two A.ipf and two B.ipf procedures are listed, both with [myIM] suffixes.While this example has "recursive" includes, the flaw wasn't related to that; recursive includes are normal and usually are no problem at all; this was an independent module #include flaw only.
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
November 28, 2013 at 08:21 am - Permalink
I already wrote to JimProuty that I could solve this problem by changing the name of the Independent Module to one without "-" in it.
I also viewed the source code of the Igor example "Slow Data Acq" under File->Recent Examples->Programming and also in this they opend the procedure files into each other:
#pragma IndependentModule=SlowDataAcq
Procedure 2 (Main)
#pragma IndependentModule=SlowDataAcq
#include "SDA Main"
#include "SDA Aquisition"
Procedure 3 (Aquisition)
#pragma IndependentModule=SlowDataAcq
#include "SDA Main"
Without any problems....
November 28, 2013 at 10:44 am - Permalink
Oh! I don't think I realized that you could have two different procedure files in the same IM this way.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
November 28, 2013 at 05:53 pm - Permalink
That is true- NIDAQ Tools MX is not threadsafe. It is definitely on my list for a future revision. It is a fairly big job and right now all my energy is devoted to trying to get Igor 7 ready.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
December 2, 2013 at 10:36 am - Permalink