Skip to content
This repository has been archived by the owner on Feb 20, 2021. It is now read-only.

Failed loadLibrary KCBv2 in Matlab #16

Open
ADNewbie opened this issue Aug 27, 2014 · 5 comments
Open

Failed loadLibrary KCBv2 in Matlab #16

ADNewbie opened this issue Aug 27, 2014 · 5 comments

Comments

@ADNewbie
Copy link

I am trying to load KCBv2 into Matlab (2014a on Windows 8.1). The library compiles fine on MS VS2013, but fails using loadLibrary following the procedure here: Matlab Link
Errors:
Function pointer types are unsupported in structures
extern "C" { found in file. C++ files are not supported. Use #ifdef __cplusplus to protect

Any suggestions?

@mkostin
Copy link
Contributor

mkostin commented Aug 29, 2014

Hi @ADNewbie

The MATLAB® shared library interface supports C library routines only.
...
The shared library interface does not support C++ classes or overloaded functions elements. However, you can apply one of the following methods to load a C++ library using loadlibrary

You could follow official workaround

The most simple approach is to use macro to wrap extern definition here just as it is suggested in the error message you've referred to.

#ifdef __cplusplus
extern "C" {
#endif

@mkostin
Copy link
Contributor

mkostin commented Sep 19, 2014

Please let me know if this is still an issue.

@ADNewbie
Copy link
Author

Hi mkostin,
Apologies for the delayed reply. Yes, the issue still exist. I have tried various approaches including your proposal above for about a week, to no avail. Admittedly I have given up. Looks like I currently don't have the skill set to solve this. It is a shame, as this could be so useful to so many people.

@cdowen
Copy link

cdowen commented Oct 21, 2015

I wonder if it is too late. But I think I find a way to use Kinect v2 in matlab without KinectCommonBridge.

The "kinect.h" in Kinect SDK actually has a C interface. Just define CINTERFACE before including "kinect.h" then you can avoid the C++ part. Of course you still need to write some code to convert data between Kinect SDK and matlab matrix and compile a library so that the interface is properly warped. But it shouldn't be too difficult. After that, you can use loadlibrary to load the library and call the functions.

I already tried the initialization part and the Kinect light up. So I believe the rest should also work.

@jmarkow
Copy link

jmarkow commented Feb 24, 2016

Hopefully I'm not too late on this but I've gotten it to work in MATLAB2015b on a Windows 8 machine,

https://github.com/jmarkow/kinect-acquisition

Not well documented but the k2 scripts in the helpers folder may help you get started.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants