I need to use in my C# code a method in a C++ DLL that was compiled in MATLAB.
There are a couple of DLLs, each has a method I need.
My assignment is to make a C# UI (Win form would be fine) that will will call this two methods which of course need to be given parameters: image and matrix.
extern LIB_alignment_C_API
bool MW_CALL_CONV mlxAlignLine(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[]);
extern LIB_libfindLines_C_API
bool MW_CALL_CONV mlxFindLines(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[]);
List of filess: https://drive.google.com/file/d/0B-5Uh7wgKQPzYV8wbEFLSjBfbTA/edit?usp=sharing
here are the H files code:
alignment.h:
//
// MATLAB Compiler: 5.1 (R2014a)
// Date: Thu Jun 12 08:45:08 2014
// Arguments: "-B" "macro_default" "-v" "-W" "cpplib:alignment" "-T" "link:lib"
// "alignLine"
//
#ifndef __alignment_h
#define __alignment_h 1
#if defined(__cplusplus) && !defined(mclmcrrt_h) && defined(__linux__)
# pragma implementation "mclmcrrt.h"
#endif
#include "mclmcrrt.h"
#include "mclcppclass.h"
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__SUNPRO_CC)
/* Solaris shared libraries use __global, rather than mapfiles
* to define the API exported from a shared library. __global is
* only necessary when building the library -- files including
* this header file to use the library do not need the __global
* declaration; hence the EXPORTING_<library> logic.
*/
#ifdef EXPORTING_alignment
#define PUBLIC_alignment_C_API __global
#else
#define PUBLIC_alignment_C_API /* No import statement needed. */
#endif
#define LIB_alignment_C_API PUBLIC_alignment_C_API
#elif defined(_HPUX_SOURCE)
#ifdef EXPORTING_alignment
#define PUBLIC_alignment_C_API __declspec(dllexport)
#else
#define PUBLIC_alignment_C_API __declspec(dllimport)
#endif
#define LIB_alignment_C_API PUBLIC_alignment_C_API
#else
#define LIB_alignment_C_API
#endif
/* This symbol is defined in shared libraries. Define it here
* (to nothing) in case this isn't a shared library.
*/
#ifndef LIB_alignment_C_API
#define LIB_alignment_C_API /* No special import/export declaration */
#endif
extern LIB_alignment_C_API
bool MW_CALL_CONV alignmentInitializeWithHandlers(
mclOutputHandlerFcn error_handler,
mclOutputHandlerFcn print_handler);
extern LIB_alignment_C_API
bool MW_CALL_CONV alignmentInitialize(void);
extern LIB_alignment_C_API
void MW_CALL_CONV alignmentTerminate(void);
extern LIB_alignment_C_API
void MW_CALL_CONV alignmentPrintStackTrace(void);
extern LIB_alignment_C_API
bool MW_CALL_CONV mlxAlignLine(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[]);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
/* On Windows, use __declspec to control the exported API */
#if defined(_MSC_VER) || defined(__BORLANDC__)
#ifdef EXPORTING_alignment
#define PUBLIC_alignment_CPP_API __declspec(dllexport)
#else
#define PUBLIC_alignment_CPP_API __declspec(dllimport)
#endif
#define LIB_alignment_CPP_API PUBLIC_alignment_CPP_API
#else
#if !defined(LIB_alignment_CPP_API)
#if defined(LIB_alignment_C_API)
#define LIB_alignment_CPP_API LIB_alignment_C_API
#else
#define LIB_alignment_CPP_API /* empty! */
#endif
#endif
#endif
extern LIB_alignment_CPP_API void MW_CALL_CONV alignLine(int nargout, mwArray& globalOffsets, mwArray& warped_ref, const mwArray& scriptImgLine, const mwArray& textImgLine, const mwArray& rectData);
#endif
#endif
libfindLines.h:
//
// MATLAB Compiler: 5.1 (R2014a)
// Date: Thu Jun 12 08:46:31 2014
// Arguments: "-B" "macro_default" "-v" "-W" "cpplib:libfindLines" "-T"
// "link:lib" "findLines"
//
#ifndef __libfindLines_h
#define __libfindLines_h 1
#if defined(__cplusplus) && !defined(mclmcrrt_h) && defined(__linux__)
# pragma implementation "mclmcrrt.h"
#endif
#include "mclmcrrt.h"
#include "mclcppclass.h"
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__SUNPRO_CC)
/* Solaris shared libraries use __global, rather than mapfiles
* to define the API exported from a shared library. __global is
* only necessary when building the library -- files including
* this header file to use the library do not need the __global
* declaration; hence the EXPORTING_<library> logic.
*/
#ifdef EXPORTING_libfindLines
#define PUBLIC_libfindLines_C_API __global
#else
#define PUBLIC_libfindLines_C_API /* No import statement needed. */
#endif
#define LIB_libfindLines_C_API PUBLIC_libfindLines_C_API
#elif defined(_HPUX_SOURCE)
#ifdef EXPORTING_libfindLines
#define PUBLIC_libfindLines_C_API __declspec(dllexport)
#else
#define PUBLIC_libfindLines_C_API __declspec(dllimport)
#endif
#define LIB_libfindLines_C_API PUBLIC_libfindLines_C_API
#else
#define LIB_libfindLines_C_API
#endif
/* This symbol is defined in shared libraries. Define it here
* (to nothing) in case this isn't a shared library.
*/
#ifndef LIB_libfindLines_C_API
#define LIB_libfindLines_C_API /* No special import/export declaration */
#endif
extern LIB_libfindLines_C_API
bool MW_CALL_CONV libfindLinesInitializeWithHandlers(
mclOutputHandlerFcn error_handler,
mclOutputHandlerFcn print_handler);
extern LIB_libfindLines_C_API
bool MW_CALL_CONV libfindLinesInitialize(void);
extern LIB_libfindLines_C_API
void MW_CALL_CONV libfindLinesTerminate(void);
extern LIB_libfindLines_C_API
void MW_CALL_CONV libfindLinesPrintStackTrace(void);
extern LIB_libfindLines_C_API
bool MW_CALL_CONV mlxFindLines(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[]);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
/* On Windows, use __declspec to control the exported API */
#if defined(_MSC_VER) || defined(__BORLANDC__)
#ifdef EXPORTING_libfindLines
#define PUBLIC_libfindLines_CPP_API __declspec(dllexport)
#else
#define PUBLIC_libfindLines_CPP_API __declspec(dllimport)
#endif
#define LIB_libfindLines_CPP_API PUBLIC_libfindLines_CPP_API
#else
#if !defined(LIB_libfindLines_CPP_API)
#if defined(LIB_libfindLines_C_API)
#define LIB_libfindLines_CPP_API LIB_libfindLines_C_API
#else
#define LIB_libfindLines_CPP_API /* empty! */
#endif
#endif
#endif
extern LIB_libfindLines_CPP_API void MW_CALL_CONV findLines(int nargout, mwArray& linesFound, mwArray& locs, const mwArray& imageMat);
#endif
#endif