Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Mata functions not found in compiled Mata library


From   Ulrich Kohler <[email protected]>
To   [email protected], [email protected]
Subject   st: Mata functions not found in compiled Mata library
Date   Mon, 26 Jun 2006 14:19:08 +0200

We have a problem concerning the compilation of Mata-files. We have 
implemented an application  “lsq.mata” that consists of some new 
Mata-functions and some self-defined Mata structures. The application is 
invoked by an Ado-File called -sqom.ado-. 

We have compiled lsq.mata and created the file “lsq.mlib”. When we execute the 
program directly after compiling of it, it works properly. However, under the 
conditions we describe in a minute, it does not. Under these conditions we 
get an  error massage telling that Stata cannot find one of the 
Mata-functions that are contained in the library. Error message is either

hashing():  3499  elemlist() not found	
sqomref(): -  function returned error	
istmt>:    -  function returned error
r(3499);

or

<istmt>:  3499  sqomref() not found
r(3499);						

where elemlist() is a constructor-function that Mata provides for 
Mata-structures, and sqomref() is Mata-function defined by ourself in 
lsq.mata. Unfortunately, we have not been able to find a regularity in 
occurance of the upper or lower error message, so far. Most of the times it 
is the upper (The second only appears on a Windows computer, and we are not 
able to reproduce it anymore) .

However, the following listing contains some situations we have tried out:

0) After using lsq.mlib on computer A that was compiled on computer B. 
Compiling lsq.mata on computer A temporarily solves the problem, but ...

1) After restarting Stata:

. do lsq.mata
. use xyz
. sqom             // -> Program runs properly
. exit
(Restart Stata)
. sqom             // -> Program does not run

2) After using -clear- as a command:

. use xyz
. do lsq.mata
. sqom              // -> program runs properly
. clear
. use abc
. sqom              // -> program does not  run

or:

. use xyz
. do lsq.mata
. sqom             // -> program runs properly
. clear
. use xyz
. sqom             // -> program does not run

But:

. use xyz
. do lsq.mata
. sqom              // -> program runs properly
. use abc, clear
. sqom              // -> program runs properly
. use xyz, clear
. sqom              // -> program runs properly 

In all cases, the compilation of Mata-file with –do lsq.mata-  solves the 
problem and program works perfectly afterwards. It seems that the program 
runs as expected after compilation as long as we do not "clear" Stata with a 
the command clear, or by exiting it. 

We do not see an explanation why compilation of “lsq.mata” solves our problem. 
Should we continue to search for the cause of the error in our source code or 
is there something that we are not aware of? Is it possible, that our problem 
is connected with the process of compilation  and creation of libraries or 
interpretation of the compiled code by Stata? 

We know that it is not easy to solve this problem without having access to  
the source code. The source code is, however, a bit long, so that we don't 
want to put it in this email. If someone likes to see the source code, please 
contact us directly. However, maybe there is something trivial that we do not 
know. 

many regards
Uli and Magda

-- 
[email protected]
+49 (030) 25491-361

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index