Newbie Q: Calling Dlls

From: Admiral Krieg (luke_krieg_spambad__at_hotmail.com)
Date: 01/26/04


Date: Mon, 26 Jan 2004 21:10:37 +0000 (UTC)

Dear Gurus,

I have recently received a DLL and the corresponding Matlab code to call
the functions therein, but alas, I am without Matlab, nor would I like to
enslave my code to its relatively slow execution speeds :-)

I'm including the "USB2_3CamDll.h", corresponding to the "USB2_
3CamDll.dll" I was given, below. Could anyone here give me a really bare-
bones MS Visual C++ coding example of how I would call the function
"WinDriver_Acquire" inside this Dll? I am ~80% sure that the Dll was
written and compiled with MS Visual C++ v.6.0, but the .h file may be
designed for use with matlab rather than MS Visual C++. I have some
rudimentary coding experience and would be writing this as a console app,
but I have never called a function from a Dll before, so if I need to
change any Project settings etc, I'd really appreciate knowing about it.

Thanks for listening people - I look forward to your replies!
Sincerely,
Luke

USB2_3CamDll.h:
===============

/*
 * USB2_3CamDll.h
 *
 * gkl 030709
 *
 */

#ifndef USB2_3CamDll_h
#define USB2_3CamDll_h

#ifndef EXPORT
#define EXPORT
#endif

/* Function declarations */

EXPORT short int WinDriver_init (void);

EXPORT void WinDriver_clear (void);

EXPORT short int WinDriver_Acquire (void *pBuffer, unsigned long count1);

EXPORT short int WinDriver_Send (unsigned char UserAdr, unsigned char
UserData);

#endif



Relevant Pages

  • Re: Problems when calling functions from a .dll
    ... > I have quite some problems with calling functions from a .dll. ... originally written in Fortran and compiled by ... > PRECISION (double in Matlab); ... > as a basic for my header file, which is based on the example file ...
    (comp.soft-sys.matlab)
  • Re: Using a C++ DLL?
    ... problem getting Matlab (R2007a on a Dell Inspiron, ... the extern "C" declaration makes no difference; ... 'mysum' definition from the .dll. ... your last was using mex. ...
    (comp.soft-sys.matlab)
  • Re: debug MEX file
    ... You must also make a .def file for your dll. ... By the way, if you are using Matlab 7.0.x, lib files for several ... version of MS Visual Studio are supplied. ... Attach to the matlab process through the "Debug menu" and choose ...
    (comp.soft-sys.matlab)
  • Re: Mex crapping on dll usage
    ... > Has anyone successfully used dlls created with labwindows with a mex ... > file created in Matlab? ... > Labwindows/CVI. ... I built a dll from it. ...
    (comp.soft-sys.matlab)
  • Matlab compiler: guidance about mclInitializeApplication and mclTerminateApplication functions requi
    ... I have created a matlab function that I would like to call from a C++ ... I first wrote a Manager dll which is intended to initialize the ... local MCR and to wrap the call to my cmd.m script: ... Documentation about Init and Terminate commands is not very clear. ...
    (comp.soft-sys.matlab)