Code Monkey home page Code Monkey logo

mexplus's People

Contributors

a-ma72 avatar chrischoy avatar kyamagu avatar patrikhuber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mexplus's Issues

Add support for templated MxArray conversions

Edit: Updating with new request, as my original code was incorrect.

I'd like to first say thank you for this library. It's very useful.

I was trying to extend MxArray with conversions to/from std::array and was running into problems with deducing the type/size of the array. If I make the from function not a member of MxArray, then I can implement the conversion:

    template <typename T, size_t N>
    mxArray* from(const std::array<T, N>& value) {
        MxArray result(MxArray::Numeric<T>(N, 1));
        result.set(value);
        return result.release();
    }

If I change from to MxArray::from, then it won't compile.

A similar attempt to implement the to function does not compile in either case:

    template <typename T, size_t N>
    void MxArray::to(const mxArray* array, std::array<T, N>* value) {
        MxArray input(array);
        for (auto i = 0u; i < N; ++i) {
            (*value)[i] = input.at<T>(i);
        }
    }

This would be a great feature to have for extending to templated data types.

Error with `arguments.h`

After I ran sqlite3.make, the following errors were shown up.

sqlite3.make
mex -c -Iinclude src/sqlite3/sqlite3.c -outdir src/sqlite3
mex -Iinclude src/api.cc src/sqlite3mex.cc src/sqlite3/sqlite3.lib -output +sqlite3/private/libsqlite3_
api.cc 
include\mexplus/mxarray.h(120) : warning C4800: 'mxArray *' : forcing value to bool 'true' or 'false' (performance warning) 
include\mexplus/mxarray.h(168) : warning C4800: 'mxArray *' : forcing value to bool 'true' or 'false' (performance warning) 
include\mexplus/mxarray.h(497) : warning C4267: 'return' : conversion from 'size_t' to 'mwSize', possible loss of data 
include\mexplus/mxarray.h(511) : warning C4267: 'return' : conversion from 'size_t' to 'mwSize', possible loss of data 
include\mexplus/mxarray.h(514) : warning C4267: 'return' : conversion from 'size_t' to 'mwSize', possible loss of data 
include\mexplus/mxarray.h(556) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data 
include\mexplus/arguments.h(175) : error C2440: 'initializing' : cannot convert from 'std::_Tree_const_iterator<_Mytree>' to 'std::_Tree_const_iterator<_Mytree>' 
        with 
        [ 
            _Mytree=std::_Tree_val<std::_Tmap_traits<std::string,const mxArray_tag *,mexplus::InputArguments::CaseInsensitiveComparator,std::allocator<std::pair<const std::string,const mxArray_tag *>>,false>> 
        ] 
        and 
        [ 
            _Mytree=std::_Tree_val<std::_Tmap_traits<std::string,const mxArray_tag *,std::less<std::string>,std::allocator<std::pair<const std::string,const mxArray_tag *>>,false>> 
        ] 
        No constructor could take the source type, or constructor overload resolution was ambiguous 
include\mexplus/arguments.h(176) : error C2678: binary '==' : no operator found which takes a left-hand operand of type 'std::_Tree_const_iterator<_Mytree>' (or there is no acceptable conversion) 
        with 
        [ 
            _Mytree=std::_Tree_val<std::_Tmap_traits<std::string,const mxArray_tag *,std::less<std::string>,std::allocator<std::pair<const std::string,const mxArray_tag *>>,false>> 
        ] 
        C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\exception(470): could be 'bool std::operator ==(const std::_Exception_ptr &,const std::_Exception_ptr &)' [found using argument-dependent lookup] 
        C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\exception(475): or       'bool std::operator ==(std::_Null_type,const std::_Exception_ptr &)' [found using argument-dependent lookup] 
        C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\exception(481): or       'bool std::operator ==(const std::_Exception_ptr &,std::_Null_type)' [found using argument-dependent lookup] 
        C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\system_error(408): or       'bool std::operator ==(const std::error_code &,const std::error_condition &)' [found using argument-dependent lookup] 
        C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\system_error(416): or       'bool std::operator ==(const std::error_condition &,const std::error_code &)' [found using argument-dependent lookup] 
        C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xtree(315): or       'bool std::_Tree_const_iterator<_Mytree>::operator ==(const std::_Tree_const_iterator<_Mytree> &) const' 
        with 
        [ 
            _Mytree=std::_Tree_val<std::_Tmap_traits<std::string,const mxArray_tag *,std::less<std::string>,std::allocator<std::pair<const std::string,const mxArray_tag *>>,false>> 
        ] 
        while trying to match the argument list '(std::_Tree_const_iterator<_Mytree>, std::_Tree_const_iterator<_Mytree>)' 
        with 
        [ 
            _Mytree=std::_Tree_val<std::_Tmap_traits<std::string,const mxArray_tag *,std::less<std::string>,std::allocator<std::pair<const std::string,const mxArray_tag *>>,false>> 
        ] 
        and 
        [ 
            _Mytree=std::_Tree_val<std::_Tmap_traits<std::string,const mxArray_tag *,mexplus::InputArguments::CaseInsensitiveComparator,std::allocator<std::pair<const std::string,const mxArray_tag *>>,false>> 
        ] 
include\mexplus/arguments.h(248) : error C2440: 'initializing' : cannot convert from 'std::_Tree_iterator<_Mytree>' to 'std::_Tree_iterator<_Mytree>' 
        with 
        [ 
            _Mytree=std::_Tree_val<std::_Tmap_traits<std::string,const mxArray_tag *,mexplus::InputArguments::CaseInsensitiveComparator,std::allocator<std::pair<const std::string,const mxArray_tag *>>,false>> 
        ] 
        and 
        [ 
            _Mytree=std::_Tree_val<std::_Tmap_traits<std::string,const mxArray_tag *,std::less<std::string>,std::allocator<std::pair<const std::string,const mxArray_tag *>>,false>> 
        ] 
        No constructor could take the source type, or constructor overload resolution was ambiguous 
include\mexplus/arguments.h(249) : error C2678: binary '==' : no operator found which takes a left-hand operand of type 'std::_Tree_iterator<_Mytree>' (or there is no acceptable conversion) 
        with 
        [ 
            _Mytree=std::_Tree_val<std::_Tmap_traits<std::string,const mxArray_tag *,std::less<std::string>,std::allocator<std::pair<const std::string,const mxArray_tag *>>,false>> 
        ] 
        C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\exception(470): could be 'bool std::operator ==(const std::_Exception_ptr &,const std::_Exception_ptr &)' [found using argument-dependent lookup] 
        C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\exception(475): or       'bool std::operator ==(std::_Null_type,const std::_Exception_ptr &)' [found using argument-dependent lookup] 
        C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\exception(481): or       'bool std::operator ==(const std::_Exception_ptr &,std::_Null_type)' [found using argument-dependent lookup] 
        C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\system_error(408): or       'bool std::operator ==(const std::error_code &,const std::error_condition &)' [found using argument-dependent lookup] 
        C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\system_error(416): or       'bool std::operator ==(const std::error_condition &,const std::error_code &)' [found using argument-dependent lookup] 
        C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xtree(315): or       'bool std::_Tree_const_iterator<_Mytree>::operator ==(const std::_Tree_const_iterator<_Mytree> &) const' 
        with 
        [ 
            _Mytree=std::_Tree_val<std::_Tmap_traits<std::string,const mxArray_tag *,std::less<std::string>,std::allocator<std::pair<const std::string,const mxArray_tag *>>,false>> 
        ] 
        while trying to match the argument list '(std::_Tree_iterator<_Mytree>, std::_Tree_iterator<_Mytree>)' 
        with 
        [ 
            _Mytree=std::_Tree_val<std::_Tmap_traits<std::string,const mxArray_tag *,std::less<std::string>,std::allocator<std::pair<const std::string,const mxArray_tag *>>,false>> 
        ] 
        and 
        [ 
            _Mytree=std::_Tree_val<std::_Tmap_traits<std::string,const mxArray_tag *,mexplus::InputArguments::CaseInsensitiveComparator,std::allocator<std::pair<const std::string,const mxArray_tag *>>,false>> 
        ] 

  C:\PROGRA~1\MATLAB\R2011A\BIN\MEX.PL: Error: Compile of 'src\api.cc' failed. 

I thought it's about arguments.h in mexplus library, so I reported here.
This is mex envirsonment in mexopts.bat
OS: Window7
Matlab version: 7.12.0 R2011a

@echo off
rem MSVC100OPTS.BAT
rem
rem    Compile and link options used for building MEX-files
rem    using the Microsoft Visual C++ compiler version 10.0
rem
rem    $Revision: 1.1.6.2 $  $Date: 2010/07/23 14:11:02 $
rem    Copyright 2007-2009 The MathWorks, Inc.
rem
rem StorageVersion: 1.0
rem C++keyFileName: MSVC100OPTS.BAT
rem C++keyName: Microsoft Visual C++ 2010
rem C++keyManufacturer: Microsoft
rem C++keyVersion: 10.0
rem C++keyLanguage: C++
rem
rem ********************************************************************
rem General parameters
rem ********************************************************************

set MATLAB=%MATLAB%
set VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 10.0
set VCINSTALLDIR=%VSINSTALLDIR%\VC
rem In this case, LINKERDIR is being used to specify the location of the SDK
set LINKERDIR=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\
set PATH=%VCINSTALLDIR%\bin\amd64;%VCINSTALLDIR%\bin;%VCINSTALLDIR%\VCPackages;%VSINSTALLDIR%\Common7\IDE;%VSINSTALLDIR%\Common7\Tools;%LINKERDIR%\bin\x64;%LINKERDIR%\bin;%MATLAB_BIN%;%PATH%
set INCLUDE=%VCINSTALLDIR%\INCLUDE;%VCINSTALLDIR%\ATLMFC\INCLUDE;%LINKERDIR%\include;%INCLUDE%
set LIB=%VCINSTALLDIR%\LIB\amd64;%VCINSTALLDIR%\ATLMFC\LIB\amd64;%LINKERDIR%\lib\x64;%MATLAB%\extern\lib\win64;%LIB%
set MW_TARGET_ARCH=win64

rem ********************************************************************
rem Compiler parameters
rem ********************************************************************
set COMPILER=cl
set COMPFLAGS=/c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD
set OPTIMFLAGS=/O2 /Oy- /DNDEBUG
set DEBUGFLAGS=/Z7
set NAME_OBJECT=/Fo

rem ********************************************************************
rem Linker parameters
rem ********************************************************************
set LIBLOC=%MATLAB%\extern\lib\win64\microsoft
set LINKER=link
set LINKFLAGS=/dll /export:%ENTRYPOINT% /LIBPATH:"%LIBLOC%" libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /manifest /incremental:NO /implib:"%LIB_NAME%.x" /MAP:"%OUTDIR%%MEX_NAME%%MEX_EXT%.map"
set LINKOPTIMFLAGS=
set LINKDEBUGFLAGS=/debug /PDB:"%OUTDIR%%MEX_NAME%%MEX_EXT%.pdb"
set LINK_FILE=
set LINK_LIB=
set NAME_OUTPUT=/out:"%OUTDIR%%MEX_NAME%%MEX_EXT%"
set RSP_FILE_INDICATOR=@

rem ********************************************************************
rem Resource compiler parameters
rem ********************************************************************
set RC_COMPILER=rc /fo "%OUTDIR%mexversion.res"
set RC_LINKER=

set POSTLINK_CMDS=del "%LIB_NAME%.x" "%LIB_NAME%.exp"
set POSTLINK_CMDS1=mt -outputresource:"%OUTDIR%%MEX_NAME%%MEX_EXT%;2" -manifest "%OUTDIR%%MEX_NAME%%MEX_EXT%.manifest"
set POSTLINK_CMDS2=del "%OUTDIR%%MEX_NAME%%MEX_EXT%.manifest"
set POSTLINK_CMDS3=del "%OUTDIR%%MEX_NAME%%MEX_EXT%.map"

Define MEX function as a MATLAB class method

Hey, pretty cool C++ wrapping of mxXXX functions.

This really doesn't affect your code per se, just a comment on your ReadMe example.

FYI, it would be more foolproof if you define MEX interface function as a private/protected method of the wrapping class. I think it's a little known secret that you can do this. Check out my hokiedsp/matlab-mexutils repo for an example.

Getting matrix data out of a struct

Hi!

I'm trying to pass a struct from Matlab to C++. The struct contains several matrices:

mesh = 
  struct with fields:

     vertices: [845×4 double]
          tvi: [1610×3 int32]

I'm having trouble reading this back into my C++ class.

template<>
void MxArray::to(const mxArray* in_array, eos::core::Mesh* mesh)
{
	MxArray array(in_array);
	// Ideally I'd like to do this:
	mesh.vertices = array.at<std::vector<glm::vec4>>("vertices");
	// (where Mesh::vertices is a std::vector<glm::vec4> obviously).

	// ... some more code, omitted ...
}

This fails to compile with a few errors like:

Error C2039 'assign': is not a member of 'glm::tvec4<float,0>'
Error C2039 'resize': is not a member of 'glm::tvec4<float,0>'

Of course I have defined a template specialisation to read this:

template<>
void MxArray::to(const mxArray* in_array, std::vector<glm::vec4>* vec)
{
	MxArray arr(in_array);
	// ... implementation ...
};

But it doesn't seem to get used. Also, defining a ::to method for just glm::vec4 doesn't fix it and results in the same compile error.

I'm a bit confused by this as when I go the opposite way, from a C++ Mesh to a Matlab struct, everything works great - I've defined a ::from method for Mesh which calls out_array.set("vertices", mesh.vertices);, which in turns calls the ::from specialisation for std::vector<glm::tvec4<float>> that I have defined.

It seems to me like the only way to read a matrix from a Matlab struct in C++ is through vector; if I do this inside the Mesh's ::to method, it compiles:

auto vertices = array.at<std::vector<double>>("vertices");

But this is quite cumbersome and repetitive I then need to convert manually from this vector<double> to my types (reshape, etc.), and I think it defies the whole purpose of the very nice concept of these converters with the to and from methods.

Am I missing something, or what is the best way to accomplish this?

Thanks!

Building issues in Ubuntu

Hi there,
I'm currently trying mexplus out, but I'm having some issues with the example building.

I'm executing
make example/private/Database_ CFLAGS="$CFLAGS -std=c++01x"
in Matlab, but nevertheless I get the message:
error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

My current gcc version is:
gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2

I have also tried
make example/private/Database_ CFLAGS="$CFLAGS -std=c++11"
and
make example/private/Database_ CXXFLAGS="$CXXFLAGS -std=c++11"

The former returns a long list of errors (I don't know if I should copy them all here, so I put just first items):
In file included from /home/jesus/Code/Matlab/mexplus/include/mexplus/mxarray.h:53:0,
from /home/jesus/Code/Matlab/mexplus/include/mexplus/arguments.h:33,
from /home/jesus/Code/Matlab/mexplus/include/mexplus.h:9,
from /home/jesus/Code/Matlab/mexplus/example/private/Database.cc:7:
/home/jesus/Code/Matlab/mexplus/include/mexplus/mxtypes.h:17:40: error: expected class-name before ‘{’ token
struct MxLogicalType : std::false_type {};
^
/home/jesus/Code/Matlab/mexplus/include/mexplus/mxtypes.h:20:39: error: ‘enable_if’ in namespace ‘std’ does not name a type
struct MxLogicalType<T, typename std::enable_if<
^
/home/jesus/Code/Matlab/mexplus/include/mexplus/mxtypes.h:20:48: error: expected template-argument before ‘<’ token
struct MxLogicalType<T, typename std::enable_if<
(... and more!)

Whereas the second try says:
/usr/bin/ld: Database.o: relocation R_X86_64_32S against `_ZTVN7mexplus16OperationCreatorE' can not be used when making a shared object; recompile with -fPIC
Database.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status

mex: link of ' "/home/jesus/Code/Matlab/mexplus/example/private/Database_.mexa64"' failed.

Is there any problem or required option that I'm missing?

Thank you very much, and I hope I can use this interesting tool!

mxGetPi - mxGetPiIsDeprecated error with Matlab R2018a

Hi!

I'm getting these two errors when compiling with mexplus with Matlab R2018a.
It seems like the mxGetPi function that is used inside mexplus/mxarray.h is deprecated and no longer available in R2018a.

Error	C3861	'mxGetPiIsDeprecated': identifier not found	eos\3rdparty\mexplus\include\mexplus\mxarray.h	1013	
Error	C3861	'mxGetPiIsDeprecated': identifier not found	eos\3rdparty\mexplus\include\mexplus\mxarray.h	1102	

Is there an easy fix for this?
If not, don't worry too much about it - I am probably going to switch to the new Matlab C++ MEX API pretty soon, as soon as I find the time for it. It's pretty nice. Mathworks finally is giving us C++ bindings after 15+ (?) years of horrible C MEX API. link, link, link.

Representing multi-dimensional arrays

Hi!

Do I see that correctly that currently, MxArray doesn't support multi-dimensional arrays? My use case is that I want to return a m x n x 3 numeric matrix from C++ to Matlab (more specifically, a 3-channel image). I think what's needed is adding functionality that calls mxCreateNumericArray to MxArray. For example, I'd start by adding a constructor

template <typename T>
static mxArray* Array(int ndims, std::vector<int> dims);

If that's all correct, I would go ahead and implement it, and if it goes well, I'm very happy to submit a PR?

Thanks!

Issues when using mexplus to wrap the dc1394 driver

This question is a little bit specific. Anyway, I would like to tell you about it, just in case you could come up with some idea if you had some similar previous experience.

I'm using MEX functions of Matlab to exploit my own library (MRPT) for Computer Vision, working in Linux (Xubuntu 14.04). Among other functionalities my library reads a generic IEEE1394 camera through the dc1394 driver. When used independently of Matlab and MEX function, everything works fine. However, I found out that when calling the dc1394 library after including mex libraries something fails with the Ring Buffer of frames. The reconstruction of the problem or bug is:

  1. I call the camera setup method, with a Ring Buffer Size of N (say 15).
  2. I call dequeue and enqueue methods to get each frame, and I get the images correctly. The acquired frames id in the Ring Buffer increases with each call as expected, from 0.
  3. When the frame id completes a Ring cycle, going back to first (0, after N captures), the driver keeps waiting a new image arrival, but nothing ever happens.

It seems to me as if the frames in the Ring Buffer are not being set to ENQUEUED state after the enqueue method, but I have checked the error variable returned by all methods and no error is detected.

Since I'm using Linux, the driver implementation which is being used (as I saw through debugging) is that called Juju.
The only thing I see is that everything seems to work correctly except for the very low level of Ring Buffer management which I think is done through Juju and/or Video1394, and that this only fails when I introduce the use of mexplus.

Are you aware of some kind of low-level issue which could arise due to some definition or incompatibility?

Eigen support

If I'm not wrong, your awesome library doesn't support Eigen. Is there any change that this will be added?

Fusing mexplus with mexopencv

I need to use cv::Mat objects, for example, and I suppose it can be also done defining new ::from and ::to methods in MxArray. However, I would like to know if there is any way I could directly use the mexopencv wrapper to use opencv objects from mexplus too.

Invalid operation: foo

Hello again,

I keep trying to make mexplus work in my computer with other projects.
I'm getting now the following error: When I add some new method to the Database example (using MEX_DEFINE(foo) and creating the function in class:
function result = foo(this, key)
%FOO Other method.
assert(isscalar(this));
result = Database_('foo', this.id_, key);
end
When executing the class method and calling to mex function I get:
Error using Database_
Invalid operation: foo

What could be the source of the error? Should I define foo elsewhere that in MEX_DEFINE(foo)?

Thank you for your help!

auto_ptr is not available anymore in VS2017.3

Hi!

std::auto_ptr is not available anymore in VS2017.3, it has been deprecated in the ISO C++ standard and MS removed it. It might be an easy fix and can just be replaced with std::unique_ptr. I'm sorry I currently don't have time to do a PR, but I still wanted to report it - maybe you've got time for it, otherwise I might get to it over the next couple of months :-)

How does this program compare with others?

I found two other C++/MATLAB class wrappers: this one and that one.

  • Do those ones have any advantages compared to yours?
  • The first one I linked asserts that it does the wrapping without memory leak. Is your wrapper also safe?

Thank you

Conversion of vector<CustomType> fails with 'assign' error

Hi!

I'm trying to improve my mexplus bindings for Eigen. One thing I need to do is pass a std::vector<Eigen::MatrixXd> to and from Matlab. My bindings work fine for passing a single Eigen::MatrixXd but when I try to pass an std::vector<Eigen::MatrixXd>, I get the following compile errors:

Severity Code Description Project File Line Suppression State
Error C2039 'assign': is not a member of 'Eigen::Matrix<double,-1,-1,0,-1,-1>' eos-matlab-test eos\3rdparty\mexplus\include\mexplus\mxarray.h 988
(on this line: value->assign(data_pointer, data_pointer + array_size);)

Severity Code Description Project File Line Suppression State
Error C2039 'assign': is not a member of 'Eigen::Matrix<double,-1,-1,0,-1,-1>' eos-matlab-test eos\3rdparty\mexplus\include\mexplus\mxarray.h 1035
(on this line: value->assign(data_pointer, data_pointer + mxGetNumberOfElements(array));)

I think I could probably write to/from functions for std::vector<Eigen::MatrixXd> to make this error disappear, and then these more specialised functions would get called. But is that a good idea? Since individual to/from functions for both std::vector as well as Eigen::MatrixXd exist, shouldn't that work and be better?

Actually, according to the readme, this should work:

// Then you can use any of the following.
std::vector object_vector;
MxArray::to<std::vector >(prhs[1], &object_vector);

but that results in the same compile errors.

Also maybe if you allow me an additional, a bit broader question: Would you advise to write the Eigen bindings in this way? Or do you have any better design suggestions? (apart from the suggestions you already gave me last year in #14, thank you very much again for that!)

Thank you very much for any help!

Possible memory leakage

Thank you for this great tool. It simplifies all interactions on mxArray's!
In the MATLAB documentation for mxSetField and mxSetCell, there is the advise to firstly free memory allocated by elements beeing displaced:
http://de.mathworks.com/help/matlab/apiref/mxsetcell.html
http://de.mathworks.com/help/matlab/apiref/mxsetfield.html
(Anyhow there is a hint in mxDestroyArray to do not ;-) I think it's meant not to leave fields or cells unset)

The reason why there might be no "real" memory leakage is due to MATLAB memory management, cleaning up, when a MEX function returns:
http://de.mathworks.com/help/matlab/matlab_external/memory-management.html

For "clean code" there should be a note about it, or a freeing function.
What do you think about?

Cheers, Andreas

Static TLS problem with Matlab

Hello again!
Pitifully regardless how useful this tool seemed to me I have encountered an almost unavoidable issue with Matlab. After preparing the mex library to use the classes defined in other libraries I'm working with (concretely the MRPT toolbox, http://www.mrpt.org/), I get the following error in Matlab during execution:
Error using MRPT.RealLRF_
Invalid MEX-file '/home/jesus/Code/Matlab/mexMRPT/+MRPT/RealLRF_.mexa64': dlopen: cannot load
any more object with static TLS

It seems as if the linked libraries of MRPT have too many dependencies, so that Matlab collapses. I think you have also worked out some similar wrapping and solutions for OpenCV, which is in some way similar to the MRPT toolbox I'm using. So, do you think there could be any workaround for this issue with static TLS in Matlab?

I highly thank you for your work and support!

Not able to set a cell with mxArray*

I currently try to set a cell item by another mxArray* item:

MxArray data( MxArray::Numeric<double>( 10, 20 ) );
MxArray cells( MxArray::Cell( 3, 3 ) );
cells.set( 0, 0, data.release() ); // cells.set( 0, data.release() ) don't too

Is there a proper way to do this?

Regards, Andreas

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.