|
I have a dll. it is OK in C/C++ and LABView.
now i'm trying to call dll from Matlab.
loading and unloading are oke!!
the dll is test.dll and header is test.h
test.h's content is:
extern "C" int PASCAL EXPORT Driver(void ** hDev);
M-file in Matlab
loadlibrary('test','test.h');
libfunctions test -full
arg = libpointer('voidPtrPtr');
%calllib('test','Driver',arg);
unloadlibrary('test');
---
when i use as above. It gives the warning message:
------------------------------------------------------------------------
Segmentation violation detected at Wed Aug 30 15:25:54 2006
------------------------------------------------------------------------
Configuration:
MATLAB Version: 7.0.1.24704 (R14) Service Pack 1
MATLAB License: 253616
Operating System: Microsoft Windows XP
Window System: Version 5.1 (Build 2600)
Processor ID: x86 Family 6 Model 6 Stepping 5, GenuineIntel
Virtual Machine: Java 1.4.2_04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM
(mixed mode)
Default Charset: ibm-5348_P100-1997
Register State:
EAX = ffffffff EBX = 108dbfb0
ECX = ffffffff EDX = 79b32664
ESI = 0f72e508 EDI = 00cddc0c
EBP = 00cddbe4 ESP = 00cddbe0
EIP = 788dc2d2 FLG = 00010286
Stack Trace:
[0] udd.dll:public: class UDInterface * __thiscall UDInterface::getReference(void)(0xffffffff, 0x108db6d0 "test", 0x00cddfa0, 0x108db830 "Driver") + 2 bytes
[1] libmwcli.dll:void __cdecl CallLibFunction(char *,char *,int,struct mxArray_tag * * const,int,struct mxArray_tag const * * const)(0x108db6d0 "test", 0x108db830 "Driver", 1, 0x00cddf38) + 572 bytes
[2] libmwcli.dll:_mfCallLib(0, 0x00cddf38, 4, 0x108db6d0 "test") + 142 bytes
[3] m_dispatcher.dll:public: virtual void __thiscall Mfh_builtin<struct mxarray_tag="">::dispatch_mf(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(0, 0x00cddf38, 4, 0x00cddf98) + 55 bytes
[4] m_dispatcher.dll:public: virtual void __thiscall Mfh_MATLAB_fn::dispatch_fh(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(0, 0x00cddf38, 4, 0x00cddf98) + 200 bytes
[5] m_interpreter.dll:int __cdecl mdDispatch(int,char const *,int,struct mxArray_tag * *,int,struct mxArray_tag * *,class Mfh_MATLAB_fn * *)(136, 0x014a0545 "calllib", 0, 0x00cddf38) + 88 bytes
[6] m_interpreter.dll:_inDispatchFromStack(136, 0x014a0545 "calllib", 0, 4) + 801 bytes
[7] m_interpreter.dll:_inCallFcnFromReference(0, 0x108dd070, 0x789b6a50, 0xcccccccd) + 176 bytes
[8] m_interpreter.dll:int __cdecl inInterp(enum inDebugCheck,int,int,enum opcodes,struct inPcodeNest_tag volatile *)(1, 0, 9, 0) + 4160 bytes
[9] m_interpreter.dll:int __cdecl inInterPcodeSJ(enum inDebugCheck,int,int,enum opcodes,struct inPcodeNest_tag *)(1, 0, 1, 0) + 272 bytes
[10] m_interpreter.dll:int __cdecl inExecuteMFunctionOrScript(class Mfh_mp *,bool)(0x0f6a39a0, 1, 0, 0x7893a5a0) + 778 bytes
[11] m_interpreter.dll:_inExecCompScript(0, 0x00cde6ac, 0x0f6a39a0, 0xffffffff) + 327 bytes
[12] m_interpreter.dll:public: void __thiscall Mfh_mp::inRunMP(int,struct mxArray_tag * *,int,struct mxArray_tag * *,struct inWorkSpace_tag *)(0, 0x00cde6ac, 0, 0x00cde70c) + 122 bytes
[13] m_interpreter.dll:public: virtual void __thiscall Mfh_mp::dispatch_file(struct _mdUnknown_workspace *,int,struct mxArray_tag * *,int,struct mxArray_tag * *)(0, 0, 0x00cde6ac, 0) + 28 bytes
[14] m_interpreter.dll:public: virtual void __thiscall Mfh_mp::dispatch_file(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(0, 0x00cde6ac, 0, 0x00cde70c) + 26 bytes
[15] m_dispatcher.dll:public: virtual void __thiscall Mfh_file::dispatch_fh(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(0, 0x00cde6ac, 0, 0x00cde70c) + 273 bytes
[16] m_interpreter.dll:int __cdecl mdDispatch(int,char const *,int,struct mxArray_tag * *,int,struct mxArray_tag * *,class Mfh_MATLAB_fn * *)(480, 0x012d66c4 "Untitled", 0, 0x00cde6ac) + 88 bytes
[17] m_interpreter.dll:_inDispatchFromStack(480, 0x012d66c4 "Untitled", 0, 0) + 801 bytes
[18] m_interpreter.dll:enum opcodes __cdecl inDispatchCall(char const *,int,int,int,int *,int *)(0x012d66c4 "Untitled", 480, 0, 0) + 138 bytes
[19] m_interpreter.dll:int __cdecl inInterp(enum inDebugCheck,int,int,enum opcodes,struct inPcodeNest_tag volatile *)(2, 0, 0, 0) + 2359 bytes
[20] m_interpreter.dll:int __cdecl inInterPcodeSJ(enum inDebugCheck,int,int,enum opcodes,struct inPcodeNest_tag *)(2, 0, 0, 0) + 272 bytes
[21] m_interpreter.dll:_inInterPcode(2, 0x78773d54, 0, 0) + 69 bytes
[22] m_interpreter.dll:enum inExecutionStatus __cdecl in_local_call_eval_function(int *,struct _pcodeheader *,int *,struct mxArray_tag * * const,enum inDebugCheck)(0x00cdf2c8, 0x00cdf3b4, 2, 1) + 162 bytes
[23] m_interpreter.dll:$L73181(0x78773d54, 0x0f71e010 "Untitled\n", 0, 0) + 196 bytes
[24] m_interpreter.dll:enum inExecutionStatus __cdecl inEvalCmdWithLocalReturnandtype(char const *,int *,enum inDebugCheck)(0x0f71e010 "Untitled\n", 0, 2, 0x00cdf444 "ôôÍ") + 69 bytes
[25] m_interpreter.dll:_inEvalCmdNoEnd(0x0f71e010 "Untitled\n", 0x00cdf4e4, 0x00cdf49c, 0x014a7f38) + 16 bytes
[26] bridge.dll:_mnParser(0x77e79f93, 0x014a7f38, 0, 0) + 431 bytes
[27] mcr.dll:public: void __thiscall mcrInstance::mnParser(void)(271244, 0x4d5c3a43, 0x414c5441, 0x31303742) + 87 bytes
[28] MATLAB.exe:0x00401d2f(4194304, 0, 271244, 0x014a7f38)
[29] MATLAB.exe:0x00403e45(0, 1, 0x7ffdf000, 0xfb76ecf4)
[30] kernel32.dll:0x77e7eb69(0x00403cc0 "jth8U@", 0, 0, 0)
Please follow these steps in reporting this problem to The MathWorks so
that we have the best chance of correcting it:
1. Send this crash report to segv@mathworks.com for automated analysis.
For your convenience, this information has been recorded in:
E:\DOCUME~1\NGUYEN~1\LOCALS~1\Temp\matlab_crash_dump.956
2. Also, if the problem is reproducible, send the crash report to
support@mathworks.com along with:
- A specific list of steps that will reproduce the problem
- Any M, MEX, MDL or other files required to reproduce the problem
- Any error messages displayed to the command window
A technical support engineer will contact you with further information.
Thank you for your assistance. Please save your workspace and restart
MATLAB before continuing your work.
Error in ==> Untitled at 5
calllib('test','Driver',arg)
----
Where is my error???
----
Help please!
Thanks
-- modified at 21:52 Wednesday 30th August, 2006
|
|
|
|
|
Hi vnc_cp
I am having the same problem, have you managed to fix it?
Rad
|
|
|
|
|
salam,omidvaram haletoon khoob bashe
ye soal daram.
ma baraye anjam projei niaz be yek mohite 3D pishrafte darim ke khaly sari bashe,az tarafi in mohit bayad betoone ba matlab tabadole etelaat kone,in mohite 3D ro man ba "Ogre"(ogre 3D engine:www.Ogre3D.org)neveshtam(be zaboon VC++ 2005)valy nemidoonam chetor mishe in barname ro be function hai ke dar MATLAB neveshte shode mortabet kard.
be nazare shoma rahi hast ke beshe inkaro kard?
mitoonam dar inbare ba shoma betore telephini sohbat konam?(khaly mamnoon misham)
khaly mamnoon
---------------------
Kamran Bigdely bsc of bioMedical Eng. ,AMIR KABIR UNIV.(polytechics of tehran)
bioMedical Eng. bsc
bioMedical Eng. bsc
|
|
|
|
|
Salam,
The easiest method is using MATLAB engine APIs (see my article[^]).
Best regards,
A. Riazi
|
|
|
|
|
Hi Everyone,
I am making an attempt to use the "mexGetArray" function to access array variables. The code is below. It's been picked up from one of the online documents, no major changes have been made.
#include "mex.h"
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
mxArray *A_ptr;
double *pr;
int num_elements, k;
A_ptr = mexGetArray("A", "base"); /* A defined in current Matlab workspace.*/
num_elements = mxGetM(A_ptr) * mxGetN(A_ptr);
pr = mxGetPr(A_ptr);
pr++;
for(k=2; k<num_elements; k++)
="" *="" k="" loop="" complete,="" does="" not="" show="" here,="" no="" idea="" why=""
="" {
="" *pr="*(pr-1)" +="" *(pr+1);
="" pr++;
="" }
="" mexputarray(a_ptr,="" "base");
}
i="" get="" the="" following="" errors.=""
="">> mex online_e.c
lcc preprocessor error: online_e.c:13 Disagreement in number of macro arguments
lcc preprocessor error: online_e.c:23 Disagreement in number of macro arguments
lcc preprocessor warning: online_e.c:24 No newline at end of file
Error online_e.c: 13 operands of = have illegal types `pointer to incomplete struct mxArray_tag defined at C:\Program Files\MATLAB71\extern\include\matrix.h 144' and `int'
Error online_e.c: 24 illegal character `\032'
4 errors, 1 warnings
C:\PROGRAM FILES\MATLAB71\BIN\MEX.PL: Error: Compile of 'online_e.c' failed.
Can anyone please shed some light on this? Thanks in advance.
Thank you,
Nanda
-- modified at 18:15 Wednesday 12th July, 2006
|
|
|
|
|
Mr. Riazi (or anyone):
I don't understand how you created the GenericDll.h file as it is not even part of the Microsoft Visuall C++ Project file (I am running MVC++.NET VErsion 2003). Why did you add that this header file as you already have the 'MatlabGenericDll.h'? Surely you would want to load the 'MatlabGenericDll.h' as oppose to this 'GenericDll.h'?
Please help...
Regards,
Reddy
-- modified at 11:22 Friday 7th July, 2006
|
|
|
|
|
Hi,
I like to give you a great thanks, you are doing a wonderful job.
I use your example and manage to solve my problem, now i see it, it was quite easy, just copy, paste and modify a little.
I wanted to think too difficult.
You deserve an A and a big hug
|
|
|
|
|
Hi,
Thanks for your comment.
Best regards,
A. Riazi
|
|
|
|
|
Hi,
I am afraid my header file is not simple at all. I have to two that i should(since i have two classes) use i believe, how do i manage this?
It is a Filter DLL
Here is one header file FilterDLL.h
#include "afxwin.h"
class CFilterDLL : public CObject
{
public:
int GetMaxNoiseLevel();
char * GetErrorString(int errcode);
// void GetErrorString(int, char *);
double GetSensorSampleRate();
int GetOverSamplingFactor();
int SetOverSamplingFactor(int);
int SetCreisMode(int);
int SetOffset(int, double);
int GetOffset(int *, double *);
double GetOffsetRegulationTime();
int GetZeroOutput();
int GetOutputDataWidth();
int SetExtParam(int, double);
int GetExtParam(int, double *);
int SetNoiseParam(int, int);
int GetNoiseParam(int *, int *);
double GetMaxSimuSensitivityTolerance();
int SetSensitivityTolerance(double);
double GetMaxSimuFilterTolerance();
int SetFilterFrequencyTolerance(double);
int GetFilterFrequencyTolerance(double *);
int GetSensitivityTolerance(double *);
double GetMaxFilterInputSampleRate();
int GetClippingElec(double *, double *);
double GetMaxFilterFrequencyTolerance();
double GetFilterFrequency();
double GetMaxSensitivityTolerance();
double GetSensitivity();
void GetChannelDescription(char *);
void GetSensorDescription(char *);
void GetDllFileName(char *);
int GetFilterVersion();
long GetOutputDataSampleCount();
double GetOutputDataSampleRate();
int GetChannelNumber();
int SetFilterType (char*);
int GetInterfaceVersion();
int SetSyncMode(int);
int GetSyncMode();
int SetDevice(int, int);
int AddDevice();
int DeleteDevice(int);
int GetClippingMech(double*, double*, double*);
int SetInputData(double*, long, double);
int Calculate();
int GetOutputData(short*);
int GetSensorValue(double, double, double*);
int SetLimitsClippingMech(double, double);
int GetLimitsClippingMech(double *, double *);
CFilterDLL();
virtual ~CFilterDLL();
protected:
bool CalculateTranferFunction();
bool FreeDLL();
void ClearProcPointer();
bool GetProcAddresses();
int m_iInterfaceVersion;
typedef int (__cdecl *BASICPROC_0) (double*, double*);
typedef int (__cdecl *BASICPROC_1) (int, double);
typedef double (__cdecl *BASICPROC_2) ();
typedef int (__cdecl *BASICPROC_3) (int);
typedef int (__cdecl *BASICPROC_4) (double);
typedef int (__cdecl *BASICPROC_5) (char*);
typedef void (__cdecl *BASICPROC_6) (char*);
typedef int (__cdecl *BASICPROC_7) ();
typedef int (__cdecl *BASICPROC_8) (int, int);
typedef void (__cdecl *BASICPROC_9) ();
typedef int (__cdecl *BASICPROC_10) (double*, double*, double*);
typedef int (__cdecl *BASICPROC_11) (double*, long, double);
typedef int (__cdecl *BASICPROC_12) (double*);
typedef int (__cdecl *BASICPROC_13) (double, double*);
typedef int (__cdecl *BASICPROC_14) (double, double);
typedef long (__cdecl *BASICPROC_15) ();
typedef int (__cdecl *BASICPROC_16) (int*, int*);
typedef int (__cdecl *BASICPROC_17) (short*);
typedef void (__cdecl *BASICPROC_18) (int, char*);
typedef int (__cdecl *BASICPROC_19) (double, double, double*);
typedef int (__cdecl *BASICPROC_20) (int*, double*);
typedef int (__cdecl *BASICPROC_21) (int, double*);
typedef char * (__cdecl *BASICPROC_22) (int);
HINSTANCE hDLL;
BASICPROC_7 m_ProcGetMaxNoiseLevel;
BASICPROC_7 m_ProcGetZeroOutput;
BASICPROC_7 m_ProcGetOutputDataWidth;
BASICPROC_1 m_ProcSetExtParam;
BASICPROC_21 m_ProcGetExtParam;
BASICPROC_8 m_ProcSetNoiseParam;
BASICPROC_16 m_ProcGetNoiseParam;
BASICPROC_2 m_ProcGetMaxSimuSensitivityTolerance;
BASICPROC_4 m_ProcSetSensitivityTolerance;
BASICPROC_2 m_ProcGetMaxSimuFilterTolerance;
BASICPROC_4 m_ProcSetFilterFrequencyTolerance;
BASICPROC_12 m_ProcGetFilterFrequencyTolerance;
BASICPROC_12 m_ProcGetSensitivityTolerance;
BASICPROC_2 m_ProcGetMaxFilterInputSampleRate;
BASICPROC_0 m_ProcGetClippingElec;
BASICPROC_2 m_ProcGetMaxFilterFrequencyTolerance;
BASICPROC_2 m_ProcGetFilterFrequency;
BASICPROC_2 m_ProcGetMaxSensitivityTolerance;
BASICPROC_2 m_ProcGetSensitivity;
BASICPROC_6 m_ProcGetChannelDescription;
BASICPROC_6 m_ProcGetSensorDescription;
BASICPROC_6 m_ProcGetDllFileName;
BASICPROC_7 m_ProcGetFilterVersion;
BASICPROC_15 m_ProcGetOutputDataSampleCount;
BASICPROC_2 m_ProcGetOutputDataSampleRate;
BASICPROC_7 m_ProcGetChannelNumber;
BASICPROC_7 m_ProcGetInterfaceVersion;
BASICPROC_3 m_ProcSetSyncMode;
BASICPROC_7 m_ProcGetSyncMode;
BASICPROC_8 m_ProcSetDevice;
BASICPROC_7 m_ProcAddDevice;
BASICPROC_3 m_ProcDeleteDevice;
BASICPROC_10 m_ProcGetClippingMech;
BASICPROC_11 m_ProcSetInputData;
BASICPROC_7 m_ProcCalculate;
BASICPROC_17 m_ProcGetOutputData;
BASICPROC_19 m_ProcGetSensorValue;
BASICPROC_14 m_ProcSetLimitsClippingMech;
BASICPROC_0 m_ProcGetLimitsClippingMech;
BASICPROC_1 m_ProcSetOffset;
BASICPROC_20 m_ProcGetOffset;
BASICPROC_2 m_ProcGetOffsetRegulationTime;
BASICPROC_3 m_ProcSetCreisMode;
// BASICPROC_3 m_ProcSetSampleVari;
BASICPROC_3 m_ProcSetOverSamplingFactor;
BASICPROC_7 m_ProcGetOverSamplingFactor;
// BASICPROC_3 m_ProcSetOutputVariation;
// BASICPROC_7 m_ProcGetOutputVariation;
BASICPROC_2 m_ProcGetSensorSampleRate;
// BASICPROC_18 m_ProcGetErrorString;
BASICPROC_22 m_ProcGetErrorString;
The second header file is OutputTooling.h
class COutputTooling
{
public:
void SaveBuffer(short *psBuffer, double dSampleRate, long lSampleCount, CString strText);
void SaveBuffer(double *pdBuffer, double dSampleRate, long lSampleCount, CString strText, int idig);
COutputTooling();
virtual ~COutputTooling();
};
I hope i won't have to rewrite the whole thing using MEX files.
I am not familiar with DLL, that's why i may seem upset
I actually work with GUI, i should be able to implement a callback to a Filter push button to filter some files and plot them.
Sorry for the mess, i hope not to take too much of your time.
Thx a lot
|
|
|
|
|
Hi,
I read somewhere i should run mbuild -setup to select the right compiler.
When i enter mbuild -setup on Matlab prompt, it says Undefined command/function 'mbuild'. I am using Matlab7.1
With mex -setup however, i am able to do the settings to select Microsoft Visual C/C++ 6.0 compiler.
Is mbuild -setup necessary somehow to load my DLL in Matlab?
Thx for your patience
|
|
|
|
|
I can't use mcc command either, so i am puzzled, are there add-ons i must add to my Matlab version?
By the way i selected 'Typical' (or 'Custom')i don't remember (The option which is always recommended) during installation.
|
|
|
|
|
Did you install MATLAB Compiler Toolbox completely?
|
|
|
|
|
hi,
I am going to reinstall Matlab, too many functions are missing, addheader, lcc etc...
Would you please look at my problem? I know you are busy
thx
|
|
|
|
|
Hi,
It is a great idea to have such a forum.
My problem is the following, i have a complicated dll written in VC++ with lots of functions and one class.
I first tried to load it directly into Matlab, but then realize it is not possible. So i am wondering how i can manage to load and use functions of my dll in Matlab?
Shall i convert my VC++ code into C-mex file? It is awfully big
Or is there a way to write a wrapper function to load my DLL?
Need help badly pls.
Thx
|
|
|
|
|
Hi,
The simplest way is to write a wrapper function to load and consume your dll, like as I did in this article (for formatting a floppy disk).
Best regards,
A. Riazi
|
|
|
|
|
Hi,
Thx for your reply. I am new to DLL concept and not familiair with complicated program, would you please use less technical terms?
I do not understand what you mean.
Thanks
|
|
|
|
|
Your header files must be simple. You can not use class or union definitions in your header file. Just use simple types like char, int and ...
Best regards,
A. Riazi
|
|
|
|
|
Hi,
I am afraid my header file is not simple at all. I have to two that i should(since i have two classes) use i believe, how do i manage this?
It is a Filter DLL
Here is one header file FilterDLL.h
#include "afxwin.h"
class CFilterDLL : public CObject
{
public:
int GetMaxNoiseLevel();
char * GetErrorString(int errcode);
// void GetErrorString(int, char *);
double GetSensorSampleRate();
int GetOverSamplingFactor();
int SetOverSamplingFactor(int);
int SetCreisMode(int);
int SetOffset(int, double);
int GetOffset(int *, double *);
double GetOffsetRegulationTime();
int GetZeroOutput();
int GetOutputDataWidth();
int SetExtParam(int, double);
int GetExtParam(int, double *);
int SetNoiseParam(int, int);
int GetNoiseParam(int *, int *);
double GetMaxSimuSensitivityTolerance();
int SetSensitivityTolerance(double);
double GetMaxSimuFilterTolerance();
int SetFilterFrequencyTolerance(double);
int GetFilterFrequencyTolerance(double *);
int GetSensitivityTolerance(double *);
double GetMaxFilterInputSampleRate();
int GetClippingElec(double *, double *);
double GetMaxFilterFrequencyTolerance();
double GetFilterFrequency();
double GetMaxSensitivityTolerance();
double GetSensitivity();
void GetChannelDescription(char *);
void GetSensorDescription(char *);
void GetDllFileName(char *);
int GetFilterVersion();
long GetOutputDataSampleCount();
double GetOutputDataSampleRate();
int GetChannelNumber();
int SetFilterType (char*);
int GetInterfaceVersion();
int SetSyncMode(int);
int GetSyncMode();
int SetDevice(int, int);
int AddDevice();
int DeleteDevice(int);
int GetClippingMech(double*, double*, double*);
int SetInputData(double*, long, double);
int Calculate();
int GetOutputData(short*);
int GetSensorValue(double, double, double*);
int SetLimitsClippingMech(double, double);
int GetLimitsClippingMech(double *, double *);
CFilterDLL();
virtual ~CFilterDLL();
protected:
bool CalculateTranferFunction();
bool FreeDLL();
void ClearProcPointer();
bool GetProcAddresses();
int m_iInterfaceVersion;
typedef int (__cdecl *BASICPROC_0) (double*, double*);
typedef int (__cdecl *BASICPROC_1) (int, double);
typedef double (__cdecl *BASICPROC_2) ();
typedef int (__cdecl *BASICPROC_3) (int);
typedef int (__cdecl *BASICPROC_4) (double);
typedef int (__cdecl *BASICPROC_5) (char*);
typedef void (__cdecl *BASICPROC_6) (char*);
typedef int (__cdecl *BASICPROC_7) ();
typedef int (__cdecl *BASICPROC_8) (int, int);
typedef void (__cdecl *BASICPROC_9) ();
typedef int (__cdecl *BASICPROC_10) (double*, double*, double*);
typedef int (__cdecl *BASICPROC_11) (double*, long, double);
typedef int (__cdecl *BASICPROC_12) (double*);
typedef int (__cdecl *BASICPROC_13) (double, double*);
typedef int (__cdecl *BASICPROC_14) (double, double);
typedef long (__cdecl *BASICPROC_15) ();
typedef int (__cdecl *BASICPROC_16) (int*, int*);
typedef int (__cdecl *BASICPROC_17) (short*);
typedef void (__cdecl *BASICPROC_18) (int, char*);
typedef int (__cdecl *BASICPROC_19) (double, double, double*);
typedef int (__cdecl *BASICPROC_20) (int*, double*);
typedef int (__cdecl *BASICPROC_21) (int, double*);
typedef char * (__cdecl *BASICPROC_22) (int);
HINSTANCE hDLL;
BASICPROC_7 m_ProcGetMaxNoiseLevel;
BASICPROC_7 m_ProcGetZeroOutput;
BASICPROC_7 m_ProcGetOutputDataWidth;
BASICPROC_1 m_ProcSetExtParam;
BASICPROC_21 m_ProcGetExtParam;
BASICPROC_8 m_ProcSetNoiseParam;
BASICPROC_16 m_ProcGetNoiseParam;
BASICPROC_2 m_ProcGetMaxSimuSensitivityTolerance;
BASICPROC_4 m_ProcSetSensitivityTolerance;
BASICPROC_2 m_ProcGetMaxSimuFilterTolerance;
BASICPROC_4 m_ProcSetFilterFrequencyTolerance;
BASICPROC_12 m_ProcGetFilterFrequencyTolerance;
BASICPROC_12 m_ProcGetSensitivityTolerance;
BASICPROC_2 m_ProcGetMaxFilterInputSampleRate;
BASICPROC_0 m_ProcGetClippingElec;
BASICPROC_2 m_ProcGetMaxFilterFrequencyTolerance;
BASICPROC_2 m_ProcGetFilterFrequency;
BASICPROC_2 m_ProcGetMaxSensitivityTolerance;
BASICPROC_2 m_ProcGetSensitivity;
BASICPROC_6 m_ProcGetChannelDescription;
BASICPROC_6 m_ProcGetSensorDescription;
BASICPROC_6 m_ProcGetDllFileName;
BASICPROC_7 m_ProcGetFilterVersion;
BASICPROC_15 m_ProcGetOutputDataSampleCount;
BASICPROC_2 m_ProcGetOutputDataSampleRate;
BASICPROC_7 m_ProcGetChannelNumber;
BASICPROC_7 m_ProcGetInterfaceVersion;
BASICPROC_3 m_ProcSetSyncMode;
BASICPROC_7 m_ProcGetSyncMode;
BASICPROC_8 m_ProcSetDevice;
BASICPROC_7 m_ProcAddDevice;
BASICPROC_3 m_ProcDeleteDevice;
BASICPROC_10 m_ProcGetClippingMech;
BASICPROC_11 m_ProcSetInputData;
BASICPROC_7 m_ProcCalculate;
BASICPROC_17 m_ProcGetOutputData;
BASICPROC_19 m_ProcGetSensorValue;
BASICPROC_14 m_ProcSetLimitsClippingMech;
BASICPROC_0 m_ProcGetLimitsClippingMech;
BASICPROC_1 m_ProcSetOffset;
BASICPROC_20 m_ProcGetOffset;
BASICPROC_2 m_ProcGetOffsetRegulationTime;
BASICPROC_3 m_ProcSetCreisMode;
// BASICPROC_3 m_ProcSetSampleVari;
BASICPROC_3 m_ProcSetOverSamplingFactor;
BASICPROC_7 m_ProcGetOverSamplingFactor;
// BASICPROC_3 m_ProcSetOutputVariation;
// BASICPROC_7 m_ProcGetOutputVariation;
BASICPROC_2 m_ProcGetSensorSampleRate;
// BASICPROC_18 m_ProcGetErrorString;
BASICPROC_22 m_ProcGetErrorString;
The second header file is OutputTooling.h
class COutputTooling
{
public:
void SaveBuffer(short *psBuffer, double dSampleRate, long lSampleCount, CString strText);
void SaveBuffer(double *pdBuffer, double dSampleRate, long lSampleCount, CString strText, int idig);
COutputTooling();
virtual ~COutputTooling();
};
I hope i won't have to rewrite the whole thing using MEX files.
I am not familiar with DLL, that's why i may seem upset
I actually work with GUI, i should be able to implement a callback to a Filter push button to filter some files and plot them.
Sorry for the mess, i hope not to take too much of your time.
Thx a lot
|
|
|
|
|
Hi,
I can not load my DLL, when i use the command
loadlibrary('Filter_SMB460_3.dll','FilterDLL2.h') i get the following error
??? Error using ==> loadlibrary
Call to Perl failed. Possible error processing header file.
and the following warning lcc preprocessor warning: C:\Program Files\MATLAB71\work\afx.h:15 C:\Program Files\MATLAB71\work\afxwin.h:19 C:\Program Files\MATLAB71\work\FilterDLL2.h:14 #error directive: MFC requires C++ compilation (use a .cpp suffix)
Plus a lot of this
Unions are unsupported in structures.
Bitfields are unsupported in structures. Structure s_DCB skipped.
How can i avoid this and get my dll running?
I thank you in advance, you are doing a great job!
|
|
|
|
|
Hi,
Sorry i actually have 2 classes, and pointes to these classes in my file.
|
|
|
|
|
Hi,
I would like to load my DLL in Matlab.
I have a very compicated one with lots of function, it's a FilterDLL
when i use
loadlibrary('Filter_SMB460_3','FilterDLL2.h')
addheader afxwin.h
i get the following error: Could not find include file "afxwin.h"
afxwin.h in a header file in FilterDLL2.
I don't understant what i am doing wrong here, need some help pls.
Great job here by the way, keep it up!
|
|
|
|
|
Hi, I'm using Visual Studio .NET, and the DLL project does not compile. Calling the pre-existing DLL in the example DOES work, I just can't get the thing to compile/build so I can make my own example functions. All I'm doing is opening the project file and telling it to "build," kinda lost on where to go from here...
|
|
|
|
|
AOA,
I've created a functional DLL in VC and am trying to
call it in Matlab 7.0. The DLL loads with the
loadlibrary call, but it gives the warning message:
>Warning: The function 'Function_Name' was not found
>in the library.
And if i try to view the functions in it using
libfunctions('DllName') it says:
>No methods for class lib.DllName or no class
>lib.DllName.
Its an MFC dll. When i call the dll from another vc
program it works fine (its just a simple dll that im
using as testing purposes to check the call from
matlab). But in matlab the functions are not found.
Any advice or help would be appreciated.
Thanks.
|
|
|
|
|
AOA,
1- Did you use any MFC based class or function in your dll?
2- Did you export functions correctly?
3- Did you use any *.def file for your dll?
Best regards,
A. Riazi
|
|
|
|
|
Hi,
Let me explain you what the actual problem is. Im working on
Hand Gesture Recognition- i'm acquiring hand gestures
in real time and based on the shape of those gestures
a powerpoint presentation is supposed to be controlled
without use of mouse or keyboard. now I have completed
the recognition work in matlab 7.0.
I have also made a program in VC for controlling a
presentation. I first tried making this in matlab but
couldnt control or run the rpesentation from matlab,
so i made it in vc.
So, half my work (recognition) is comlpeted in
matlab7. the other half is comlpeted in VC. The
problem is now to integrate the 2. Thats why im
thinking of making the VC program as a DLL. I cant use
m-files in VC as add-in because the matlab 7 compiler
doesnt support this, only mat6 supports this. But the
problem with mat6 now is that it doesnt have the image
processing toolbox.
I hope you understand the problem now. Give me any suggestions u would like to tell.
Thanks.
|
|
|
|
|