help-octave
[Top][All Lists]
Advanced

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

Re: Passing pointers from mex->octave->mex


From: Jose
Subject: Re: Passing pointers from mex->octave->mex
Date: Tue, 25 Oct 2011 13:48:39 +0300
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110922 Thunderbird/3.1.15

On 10/13/2011 06:20 PM, Arnaud BARRE wrote:
How to make octave to store a pointer to a structure created in a mex file
and how to pass that pointer to another mex file?

You can also check the utility "Mex Object Handle" realized by Tim
Bailey (http://www-personal.acfr.usyd.edu.au/tbailey/software/index.html).
It is in C++, but the main idea is here and the main part of the code
can be translated in C. Moreover, this utility is for Matlab but works
well under Octave (At least with the tests I realized).

Thanks Arnaud for this valuable reference.

I am testing the code now. I had to do some minor changes to make it work in my machine. Here I put them for future reference:

1-Assuming that all the .h and .cpp files are in the same directory (as they come in the zip file), change #include "../ObjectHandle.h" to #include "ObjectHandle.h" in mex_destroy.cpp and mex_create.cpp

2-Change lines 113 and 114 of ObjectHandle.h to
typename std::list<ObjectHandle<T>*>::iterator i;
typename std::list<ObjectHandle<T>*>::iterator end= objlist.end();
(note the addition of 'typename')

3-It seems that the code is for 32 bits. As I have a 64 bits machine, I had to change all the occurences of mxINT32_CLASS to mxINT64_CLASS (lines 140 and 167)

That made the trick, at least the mex_handletest works now.

BR
Jose


reply via email to

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