WICHTIG: Der Betrieb von goMatlab.de wird privat finanziert fortgesetzt. - Mehr Infos...

Mein MATLAB Forum - goMatlab.de

Mein MATLAB Forum

 
Gast > Registrieren       Autologin?   

Partner:




Forum
      Option
[Erweitert]
  • Diese Seite per Mail weiterempfehlen
     


Gehe zu:  
Neues Thema eröffnen Neue Antwort erstellen

Mex-File aus c-Code mit externer Libary erstellen

 

uli
Forum-Newbie

Forum-Newbie


Beiträge: 1
Anmeldedatum: 04.10.12
Wohnort: ---
Version: ---
     Beitrag Verfasst am: 04.10.2012, 11:07     Titel: Mex-File aus c-Code mit externer Libary erstellen
  Antworten mit Zitat      
Ich versuche für eine Kamera Ansteuerung über Matlab zu realisieren. für den Controller der Kamera besitze ich ein SDK mit folgenden einer Libary für für einen Borland Compiler.

Wenn ich den c-code der vom Hersteller als Bsp. bereitgestellt wurde mit dem Befehl:
Code:
mex test.c SisApiBC.lib

aufrufe erhalte ich die folgenden Fehler:

Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
test.c:
Error E2313 SISAPI.H 223: Constant expression required
Error E2303 SISAPI.H 273: Type name expected
Error E2303 SISAPI.H 278: Type name expected
Error E2303 SISAPI.H 284: Type name expected
Error E2303 SISAPI.H 286: Type name expected
Error E2303 SISAPI.H 287: Type name expected
Error E2303 SISAPI.H 294: Type name expected
Error E2303 SISAPI.H 299: Type name expected
Error E2147 SISAPI.H 300: 'LPSTR' cannot start a parameter declaration
Error E2147 SISAPI.H 301: 'LPSTR' cannot start a parameter declaration
Error E2147 SISAPI.H 302: 'DWORD' cannot start a parameter declaration
Error E2303 SISAPI.H 303: Type name expected
Error E2451 test.c 25: Undefined symbol 'LPWORD' in function mexFunction
Error E2379 test.c 25: Statement missing ; in function mexFunction
Error E2451 test.c 26: Undefined symbol 'WORD' in function mexFunction
Error E2379 test.c 26: Statement missing ; in function mexFunction
Error E2140 test.c 27: Declaration is not allowed here in function mexFunction
Error E2451 test.c 48: Undefined symbol 'lpMyFrame' in function mexFunction
Error E2109 test.c 48: Not an allowed type in function mexFunction
Error E2109 test.c 65: Not an allowed type in function mexFunction
Error E2451 test.c 68: Undefined symbol 'lpMyData' in function mexFunction
*** 21 errors in Compile ***

C:\PROGRA~1\MATLAB\R2007B\BIN\MEX.PL: Error: Compile of 'test.c' failed.


Ich vermute, dass ich die Libary des Herstellers nicht richtig eingebunden habe.

Der Code der angegebenen Headerdatei lautet:
Code:

/******************************************************************************
********************************************************************************


            S I S A P I . H


********************************************************************************
*******************************************************************************

Function-Prototypes and Definitions for SISAPI.DLL

*******************************************************************************

 # Date       Comment                         von
-- ---------- ------------------------------------------------------------- ---
00 30.04.2004 Revision 7.00a                           wny

*******************************************************************************/

#ifndef __SISAPI_H
#define __SISAPI_H


#ifdef  SISAPI_DLLSOURCE
// ... Funktionen werden exportiert...

#define  decl        __declspec(dllexport)
#define  callconv   __stdcall

#else
// ... Funktionen werden importiert...

// Microsoft...
#ifdef   _MSC_VER
#define  decl        __declspec(dllimport)
#define  callconv   __stdcall
#endif

// Borland...
#ifdef   __BORLANDC__
#define  decl
#define  callconv   __import __stdcall
#endif

#endif
// !SISAPI_DLLSOURCE



//=============================================================================
//
// Constants
//
//=============================================================================


// Max. 4 SIS-Interfaces per System...
//------------------------------------
#define SIS_MAXINTERFACENUMBER      4


// DebugMode-Flags...
//-------------------
#define SIS_DEBUG_NOTHING      0x00000000
#define SIS_DEBUG_MESSAGEBOX      0x00000001
#define SIS_DEBUG_MESSAGEBOX_WARNINGS   0x00000002

#define SIS_DEBUG_PCIINFO        0x00000100
#define SIS_DEBUG_SCANFRAME      0x00000200
#define SIS_DEBUG_TIME         0x00000400
#define SIS_DEBUG_LOGFILEPIXEL      0x00000800
#define SIS_DEBUG_SERIAL      0x00001000
#define SIS_DEBUG_STARTFUNCTION      0x00002000
#define SIS_DEBUG_TRIGGER      0x00004000
#define SIS_DEBUG_SETBINNING      0x00008000
#define SIS_DEBUG_ALL         0xFFFFFF00


// Einlese-Verfahren...
//---------------------
#define SIS_SCANTYPE_POLLING      0   // Polling
#define SIS_SCANTYPE_INTPOLL      1   // Interrupt/Polling
#define SIS_SCANTYPE_INTERRUPT      2     // Interrupt
#define SIS_SCANTYPE_COMPATIBLE      3   // Kompatibilitäts-Modus (only ISA)
#define SIS_SCANTYPE_DMADEMAND      4   // DMA-Demand-Mode (only PLX9054)


// Interface-Types...
//-------------------
#define SIS_INTERFACE_NOTINSTALLED   0   // nicht installiert
#define SIS_INTERFACE_ISA      1   // ISA-Interface
#define SIS_INTERFACE_PCI      2   // PCI-Interface
#define SIS_INTERFACE_PCI9054      3   // PCI-Interface mit PLX9054
#define SIS_INTERFACE_VIRT_ISA      11   // virtuelles ISA-Interface (für TESTs)
#define SIS_INTERFACE_VIRT_PCI      12   // virtuelles PCI-Interface (für TESTs)
#define SIS_INTERFACE_VIRT_PCI9054   13   // virtuelles PLX9054-Interface (für TESTs)


// Error-Codes...
//---------------
#define SIS_OK            0
#define SIS_ERROR_BASE         0x00010000
#define SIS_ERROR_UNKNOWN      (SIS_ERROR_BASE + 1)
#define SIS_ERROR_WRONGPARAMETER   (SIS_ERROR_BASE + 2)
#define SIS_ERROR_WRONGHANDLE      (SIS_ERROR_BASE + 3)
#define SIS_ERROR_FUNCTIONNOTIMPL   (SIS_ERROR_BASE + 4)
#define SIS_ERROR_TIMEOUT      (SIS_ERROR_BASE + 5)
#define SIS_ERROR_CAMCONFIG      (SIS_ERROR_BASE + 6)
#define SIS_ERROR_NOTINIT      (SIS_ERROR_BASE + 7)
#define SIS_ERROR_ALLOC         (SIS_ERROR_BASE + 8)
#define SIS_ERROR_INITCOMPORT      (SIS_ERROR_BASE + 9)


// Acquisition-Modes...
//------------------------
#define SIS_ACQ_FREEZE         0
#define SIS_ACQ_SINGLESHOT      1
#define SIS_ACQ_CONTINOUS      -1


// Miscellaneous...
//-----------------
// only for sis_TextOutSisData()...
#define SIS_DIAG_NOTHING      0x00000000
#define SIS_DIAG_GENERAL      0x00000001
#define SIS_DIAG_ADDRESSES      0x00000002
#define SIS_DIAG_ACQUISITION      0x00000008
#define SIS_DIAG_INTERRUPT      0x00000010
#define SIS_DIAG_MISCELLANEOUS      0x00000020
#define SIS_DIAG_BINNING      0x00000040
#define SIS_DIAG_ALL         0xFFFFFFFF



//=============================================================================
//
// Typ-Definitions
//
//=============================================================================


// ------ Integer 8 Bit ------
#ifndef INT8
typedef char            INT8;
typedef INT8*            pINT8;
#endif
#ifndef UINT8
typedef unsigned char                   UINT8;
typedef UINT8*            pUINT8;
#endif

// ------ Integer 16 Bit ------
#ifndef INT16
typedef signed short                    INT16;
typedef INT16*            pINT16;
#endif
#ifndef UINT16
typedef unsigned short                  UINT16;
typedef UINT16*            pUINT16;
#endif

// ------ Integer 32 Bit ------
#ifndef INT32
typedef signed int         INT32;
typedef INT32*            pINT32;
#endif
#ifndef UINT32
typedef unsigned int         UINT32;
typedef UINT32*            pUINT32;
#endif

// ------ Integer 64 Bit ------
#ifndef INT64
typedef __int64            INT64;
typedef INT64*            pINT64;
#endif

// ------ Float ------
#ifndef FLOAT32
typedef float            FLOAT32;
typedef FLOAT32*         pFLOAT32;
#endif
#ifndef FLOAT64
typedef double            FLOAT64;
typedef FLOAT64*         pFLOAT64;
#endif



// SIS-Error-Code...
//------------------
typedef  UINT32  SISERROR;


// Binning-Definitions only for sis_SetBinningEx()...
//---------------------------------------------------

#ifndef __IMAGE_BINNINGDEFINITION
#define   __IMAGE_BINNINGDEFINITION

const UINT32 IMAGE_MAX_YBINNINGAREAS      = 16;

typedef struct  tagIMAGE_YBINNINGAREA {  
    INT32       nY;          // Y-Binning-Factor for this Area [0..256]
                // 1: no Binning
    INT32       nFromRowFF;       // Binning-Area: From Row (FullFrame)
    INT32       nToRowFF;       //          ... To Row.(FullFrame)
    INT32       nIsStartRow;    // Resulting Frame: From Row
    INT32       nIsRowNr;       //          ... Number of Rows.
} IMAGE_YBINNINGAREA;
typedef IMAGE_YBINNINGAREA*       pIMAGE_YBINNINGAREA;

typedef struct  tagIMAGE_BINNINGDEFINITION {
    INT32       nX;          // 1,2,4,8
                // 0 oder 1: no X-Binning
    INT32       nY;          // Y-Binning-Factor [0..256]
                // 0: ext.Binning Yarea[]
                // 1: no Y-Binning
                // 2..256: simple Y-Binning
    INT32       nMaxYSkipping;  // max.Number of Skipping Lines [0..256]
                // only for ext.Binning Yarea[]
    IMAGE_YBINNINGAREA    Yarea[IMAGE_MAX_YBINNINGAREAS];
} IMAGE_BINNINGDEFINITION;
typedef IMAGE_BINNINGDEFINITION*    pIMAGE_BINNINGDEFINITION;

#endif   //__IMAGE_BINNINGDEFINITION



// only for sis_Get()...
//----------------------
typedef  enum tagSISGET_INDEX {
    SISGET_NOTHING,
    SISGET_SISDATAADDRESS,   // void *lpData
    SISGET_FRAMEWIDTH,      // int *lpData
    SISGET_FRAMEHEIGHT,      // int *lpData
    SISGET_ALLOCFRAMENUMBER,   // int *lpData
    SISGET_ROI,         // RECT *lpData
    SISGET_ACQMODE,      // int *lpData
    SISGET_ACQFRAMECOUNT,   // int *lpData
    SISGET_ACQADDRESS,      // WORD **lpData
    SISGET_ACTWIDTH,      // int *lpData
    SISGET_ACTHEIGHT,      // int *lpData
    SISGET_ACTROI,      // RECT *lpData
    SISGET_ACTFRAMENR,      // int *lpData
    SISGET_ACTFRAMEIX,      // int *lpData
    SISGET_ACTSYNCTIME,      // FILETIME *lpData
    SISGET_BINNINGENABLE,   // bool *lpData
    SISGET_CAMERANAME,      // char*
    SISGET_TIMETRIGGER,      // FILETIME *lpData
    SISGET_INTTIME,      // DWORD *lpData
    SISGET_REPTIME,      // DWORD *lpData
    SISGET_MASTERMODE,      // BYTE *lpData
    SISGET_OPMODE      // BYTE *lpData
} SISGET_INDEX;




//=============================================================================
//
// Function-Prototypes
//
//=============================================================================

#ifdef __cplusplus
extern "C" {
#endif


// Initialisation...
decl SISERROR   callconv sis_Open (int nSIShandle, LPCSTR szCamConfigFile);
decl SISERROR   callconv sis_Reset (int nSIShandle);
decl SISERROR   callconv sis_Close (int nSIShandle);

// Configuration...
decl SISERROR   callconv sis_SetROI (int nSIShandle, LPRECT lpROI);
decl SISERROR   callconv sis_SetBinning (int nSIShandle,
                int nXbinning, int nYbinning);
decl SISERROR   callconv sis_SetBinningEx (int nSIShandle,
                pIMAGE_BINNINGDEFINITION lpBinning);
decl SISERROR   callconv sis_SetTiming (int nSIShandle,
               DWORD nIntegrationTimeMicroS,
               DWORD nRepetitionTimeMicroS);
decl SISERROR  callconv sis_SetMasterMode (int nSIShandle, BYTE MasterMode);
decl SISERROR  callconv sis_SetOperationMode (int nSIShandle, BYTE OperationMode);

// Acquisition...
decl SISERROR   callconv sis_StartAcq (int nSIShandle, int nAcqMode);
decl SISERROR   callconv sis_StopAcq (int nSIShandle);
decl SISERROR   callconv sis_AbortAcq (int nSIShandle);
decl SISERROR   callconv sis_WaitAcqEnd (int nSIShandle, int nTimeout_ms);
decl SISERROR   callconv sis_CopyAcqData (int nSIShandle, int nFrameIndex, LPWORD lpAcqData);
decl SISERROR   callconv sis_StartSequenceAcq (int nSIShandle, int nFrameNr, int nPreTriggerFrameNr);
decl SISERROR   callconv sis_SignalSequenceEvent (int nSIShandle);

// Information...
decl SISERROR   callconv sis_Get (int nSIShandle, SISGET_INDEX sdindex, LPVOID lpData);
decl SISERROR   callconv sis_GetLastError (LPSTR szError);
decl SISERROR   callconv sis_GetDriverRevision (LPSTR szRevString);
decl SISERROR   callconv sis_SetDebug (DWORD dwDebugMode);
decl SISERROR   callconv sis_TextOutSisData (int nSIShandle, LPSTR szSisData, DWORD dwDiagInfo);


#ifndef SISAPI_DLLSOURCE
#undef   decl
#undef   callconv
#endif


#ifdef __cplusplus
} // end of 'extern "C"'
#endif


#endif
// __SISAPI_H



/*******************************************************************************
**
** end of SISAPI.H
**
*******************************************************************************/
 




Vielen Dank für euer Hilfe
Uli
Private Nachricht senden Benutzer-Profile anzeigen


Neues Thema eröffnen Neue Antwort erstellen



Einstellungen und Berechtigungen
Beiträge der letzten Zeit anzeigen:

Du kannst Beiträge in dieses Forum schreiben.
Du kannst auf Beiträge in diesem Forum antworten.
Du kannst deine Beiträge in diesem Forum nicht bearbeiten.
Du kannst deine Beiträge in diesem Forum nicht löschen.
Du kannst an Umfragen in diesem Forum nicht mitmachen.
Du kannst Dateien in diesem Forum posten
Du kannst Dateien in diesem Forum herunterladen
.





 Impressum  | Nutzungsbedingungen  | Datenschutz | FAQ | goMatlab RSS Button RSS

Hosted by:


Copyright © 2007 - 2025 goMatlab.de | Dies ist keine offizielle Website der Firma The Mathworks

MATLAB, Simulink, Stateflow, Handle Graphics, Real-Time Workshop, SimBiology, SimHydraulics, SimEvents, and xPC TargetBox are registered trademarks and The MathWorks, the L-shaped membrane logo, and Embedded MATLAB are trademarks of The MathWorks, Inc.