Jasvirbahl / b-tk

Automatically exported from code.google.com/p/b-tk
0 stars 0 forks source link

Wrapper for GNU Octave #17

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I thought it would be nice to have also a wrapper for GNU Octave. As Octave 
also supports loading of .mex files, I modified some files to get the Matlab 
wrappers compiled for Octave.

Attached you find my changes and additional files. They are rather quick and 
dirty, however work on my ubuntu a64 machine and revision #680 of b-tk.

To get it run under windows some more work would be required.

Original issue reported on code.google.com by martin.f...@gmail.com on 27 Jul 2011 at 10:33

Attachments:

GoogleCodeExporter commented 8 years ago
Thank you very much for this patch Martin. 

I am able to compile the MEX-files for Octave 3.4.0 under MacOS 10.5.8 without 
any problem.

The revision r705 is based on your code. To not have two times the definitions 
of the function to build (and the possibility to forgot to update one of them 
when adding/modifying a function), I move these definitions in the file 
CMakeLists.part.in. I have to implement the CMake part for Windows.

From my first try, everything is right except when a C++ exception is thrown. 
For example, if you use the function btkReadAcquisition with an error in the 
path, then no error is displayed by Octave. It looks like everything is right 
and I have a new prompt. But when I execute the next command, Octave doesn't 
respond anymore. I have to kill it. Have you the same problem under Linux?

Original comment by arnaud.barre on 28 Jul 2011 at 12:31

GoogleCodeExporter commented 8 years ago
No problem to wrap BTK for Octave 3.2.4 (i686-pc-mingw32_gcc-4.4.0) under 
Windows. 

However, the user has to configure manually the CMake project. Firstly, as the 
downloadable binary use MinGW, it is not possible to use MSVC. Then it is 
important to select the "MinGW Makefiles" generator. Secondly, Octave embedded 
its own version of MinGW and then must be added in the environment variable 
PATH, otherwise CMake won't detect the compiler. Thirdly, the name of the 
executables for the C and C++ compiler are not recognize by cmake (looking for 
gcc.exe and g++.exe, but the filenames in Octave 3.2.4 are 
mingw32-gcc-4.4.0-dw2.exe and mingw32-g++-4.4.0-dw2.exe). So they must be 
selected manually (here in the folder C:\Octave\3.2.4_gcc-4.4.0\mingw32\bin). 
Finally, it is important to strip the libraries (-s option for the variable 
CMAKE_EXE_LINKER_FLAGS and CMAKE_SHARED_LINKER_FLAGS) to reduce the size of the 
files (from 4Mb to 5kb in general for each MEX files).

As with MacOS X, I have a similar behavior when a C++ exception is thrown. This 
time, I have the error displayed, I can continue to use Octave (open a new 
acquisition, etc). But, when I use the command 'exit', then Octave crashes. I 
didn't find (yet) any information on this issue.

Original comment by arnaud.barre on 28 Jul 2011 at 7:24

GoogleCodeExporter commented 8 years ago
I investigated a little bit more the problem under MacOS X and it seems it is 
related to the standard output and error redirection not re-initialized after 
the use of the MEX function 'mexErrMsgTxt'. Need to be investigated under 
Windows.

Original comment by arnaud.barre on 11 Aug 2011 at 6:42

GoogleCodeExporter commented 8 years ago
This issue seems completely resolved since the revision r736.

Original comment by arnaud.barre on 1 Sep 2011 at 10:01