Page 1 of 1

addin problem....?

Posted: Tue Jun 17, 2014 7:50 am
by tvonbrasch
Hi,

I have a problem with Eviews, and it might be due to the addin that i have made, but i am not sure...?

If you install the global addin addtospec with the command
'indexinstall
addin(type=global, menu = "adds new string in a system equation" , proc="addtospec", desc="adds new string in a system equation") "./addtospec.prg"


and if you run the program "problem_with_addin.prg" on the attached workfile, Eviews will close. But I do not understand why...?

Trying to find the error, I noted something interisting,

Eviews will close when running the program


delete ags_s
svector ags_s=ags.@svectornb
!r=@rows(ags_s)

'add instruments
for !k=1 to 10' "r
'finding country and industry codes in each equation
%var=@word(ags_s(!k),1)
!length=@length(%var)
%id=@mid(ags_s(!k),11, !length-11)
'add instrument
addtospec(k=!k, add= @ log(tfpr_{%id}(-2)) ) ags 'addin that adds a line to the system specification
next



however, if only running


!r=@rows(ags_s)

'add instruments
for !k=1 to 10' "r
'finding country and industry codes in each equation
%var=@word(ags_s(!k),1)
!length=@length(%var)
%id=@mid(ags_s(!k),11, !length-11)
'add instrument
addtospec(k=!k, add= @ log(tfpr_{%id}(-2)) ) ags 'addin that adds a line to the system specification
next


Eviews will not crash. I do not understand why...

Can you please help me
Thomas

Re: addin problem....?

Posted: Tue Jun 17, 2014 8:06 am
by EViews Gareth
Seemed to work just fine for me. Which version of EViews are you using, and what is the build date?

Re: addin problem....?

Posted: Tue Jun 17, 2014 8:11 am
by tvonbrasch
Eviews 8, Jun 4 2014 build.

You might have to run it a couple of times before Eviews crashes.

Thanks for looking at this
Thomas

Re: addin problem....?

Posted: Tue Jun 17, 2014 8:16 am
by tvonbrasch
Now it worked with the code I gave you. But if you run the code

svector ags_s=ags.@svectornb
'add instruments
for !k=1 to @rows(ags_s)
' 'finding country and industry codes in each equation
%var=@word(ags_s(!k),1)
!length=@length(%var)
%id=@mid(ags_s(!k),11, !length-11)
'add instrument
addtospec(k=!k, add= @ log(tfpr_{%id}(-2)) ) ags 'addin that adds a line to the system specification
next


it will crash.
Thomas

Re: addin problem....?

Posted: Tue Jun 17, 2014 8:48 am
by tvonbrasch
I tried it once more, when the loop goes from 1 to 10, and Eviews crashes again....

Thomas

Re: addin problem....?

Posted: Tue Jun 17, 2014 9:42 am
by EViews Gareth
Got it. It is an issue when a parent program accesses a data member of an object, then execs a program that deletes that object. We'll see if we can get it fixes asap (although this one is tricky...)

Re: addin problem....?

Posted: Tue Jun 17, 2014 10:07 am
by tvonbrasch
excellent, thanks!
thomas