From octave-maintainers-request at bevo dot che dot wisc dot edu Fri Dec 13 15:02:15 2002 Subject: Re: Creating a standalone executable From: Paul Kienzle To: JD Cole Cc: octave-maintainers at bevo dot che dot wisc dot edu Date: Fri, 13 Dec 2002 16:01:50 -0500 JD, The '+' operator is looked up in a three dimensional array of op x type x type. You will want to go into octave.cc and look at the octave_main function. Depending on what you are doing, you will need to include various pieces from there, in this case install_ops(). Doug, are you adding this to your help document? Paul Kienzle pkienzle at users dot sf dot net On Fri, Dec 13, 2002 at 12:37:46PM -0800, JD Cole wrote: > I am trying to write a standalone application using the Octave API and > am running into some trouble when I actually run the application. Here's > what I did: > > source code (a.cc) > ========= > #include > > #include > > using namespace std; > > int main(int argc, char *argv[]) > { > octave_value a(10.0),b(20.0),c; > > c = a + b; > > c.print(cout); > > return (0); > } > > how I compiled it > ============= > Initially I tried using the "--link-stand-alone" argument to mkoctfile, > but it seemed to be missing the library arguments "-lkpathsea > -loctinterp" or else I get missing symbols related to these two libraries. > > So I used "mkoctfile -c a.cc -o a.o" to copile the object file and then > added the above libraries to the output of "mkoctfile --verbose -o a > a.o". Which seems to compile just fine. > > when I ran it > ========= > Running "./a" yields the following output: > > fatal: range error in Array3 > > This error comes from "checkelem" in Arrray3.h. Of course, to my > knowledge, I'm only using scalars. I tried changing my source to just "c > = a" rather than "c = a +b" and it performed as expected. I investigated > the operator instantiations of "+" in ov.h and was a bit confused. > > Another note: I did try putting the above code into a DLD_FUNTION and it > performed as expected. > > I guess my question here is, "Has anyone done this before?" > > Best, > > JD > >