help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

using functions found in oct files from c++


From: Søren Hauberg
Subject: using functions found in oct files from c++
Date: Mon, 25 Sep 2006 18:38:40 +0200

Hi,
  If I want to perform (as an example) 2D convolution in C++ I see
several possibilities

1) Implement it myself.
2) Use feval to call the interpreter.
3) Include the source for conv2.oct in my program.

1) isn't any fun, so I won't do that. 
2) isn't very efficient which is the entire point of working in C++. 
3) will result in code duplication.

The last option seems like the best to me, but I was wondering if there
is a way of calling the C++ functions found in oct files. So if I have
an oct file with this source code:

void some_function(Matrix &M) {
  // Do stuff
}

DEFUN_DLD(my_dld, args, nargout,"") {
  some_function(args(0).matrix_value());
  return octave_value_list;
}

can I somehow call "some_function" from another oct file?

Søren



reply via email to

[Prev in Thread] Current Thread [Next in Thread]