C++] API헤더파일에서 함수 정의할 때 앞에 계속나오는 SR_API(int) 는 무슨 의미죠? RRS feed

  • 질문

  • 제공받은 API 샘플입니다. 헤더 파일에 함수가 정의되어 있는데요 앞에 SR_API(int) 가 붙는게 어떤 의미인지 이해가 되지 않습니다.

    아래 코드 전문을 보시면 이해가 빠를 것입니다. (SR이라 함은 제공되는 제품의 모델명입니다.)

    /*------------------------------------------------------------------------*/ /* */ /* Copyright (c) 2008 by MESA Imaging SA, */ /* */ /*------------------------------------------------------------------------*/ // $Author$ // $URL$ // $Rev$ // $Date$ /*------------------------------------------------------------------------*/ //!\file //!contains functions for SR API #pragma once #ifndef __LIBMESA_SR__H #define __LIBMESA_SR__H #endif #ifdef __cplusplus extern "C" { #endif #ifdef _WIN32 // The following ifdef block is the standard way of creating macros which make import/export // from a DLL simpler. All files within this DLL are compiled with the _SR_API_DLL // symbol defined on the command line. this symbol should not be defined on any project // that uses this DLL. #if defined(_SR_API_DLL)//using file libMesaSR.h, libMesaSR.cpp to generate libMesaSR.dll #define SR_API(RETURN) __declspec(dllexport) RETURN __cdecl #elif defined(MATLAB_PREPROC)//Preprocessing for matlab interface #define SR_API(RETURN) RETURN #elif !defined(DOXYGEN) //using file libMesaSR.h with libMesaSR.dll #define SR_API(RETURN) __declspec(dllimport) RETURN __cdecl #endif #else //LINUX #define SR_API(RETURN) __attribute__ ((visibility("default"))) RETURN #endif #include "definesSR.h" //!\addtogroup libMesaSR //!@{ //--------- interfaces for C++, Delphi etc. ------------ #ifdef _WIN32 //!Performs a check for a new driver release (Windows only). //!If a new driver is available, a dialog is displayed containing a hyperlink to the download website. //! It requires internet connection and does not support Autoproxy. //!- To force the check to the last available version set the mode to 3 //!- if mode = 0 it only does the check if the last check has been done a long time before //!- if mode & 1 it always checks the version for new drivers //!-if mode & 2 it also informs about version entries with no info tag //! //!if mode is 0 the driver update check can be disabled by setting the registry key: //!\verbatim //!HKEY_CURRENT_USER\Software\MesaImaging\Swissranger\nextHttpDllTestDate //!to REG_QWORD 0x ff ff ff ff ff ff ff (14 F 's) //!\endverbatim SR_API(int) SR_CheckForNewDllVersion(int mode); //!Opens the Swissranger File and returns a virtual device ID. //!This can be used for offline development of software using test data streams (.srs files). //!Once the software is working, a real camera can be substituted for the test stream with minimal changes to the software. //!Such a file can be generated with with SR_StreamToFile(). //!Any settings that affect the data sent from the camera will be ignored. //! \return the return value is the number of opened cameras: therefore <=0 means FAILED. SR_API(int) SR_OpenFile(SRCAM* srCam, const char* filename); //!SR_StreamToFile opens a file and streams received Data from the camera to that file. //!This file can subsequently be opened and treated as a virtual camera using SR_OpenFile(). //!The mode can be: //!- 0 : Open-Create //!- 1 : Open-Append NOT IMPLEMENTED //!- 2 : Close SR_API(int) SR_StreamToFile(SRCAM srCam, const char* filename, int mode); //!SR_FileStreamCmd jump/setup the reading of srs streams. SR_API(int) SR_FileStreamCmd(SRCAM srCam, FSCmd cmd, DWORD data, void* ptr=0); #endif #ifdef __BFIN__ //! Generic Open for the Blackfin ported libMesaSR. SR_API(int) SR_Open(SRCAM* srCam); SR_API(int) SR_IsFrameAvailable(SRCAM srCam); #else //! Generic Open for any kind of camera. //! This opens a dialog box and lists all available USB and Ethernet swissranger Cameras. //! One of them can be selected and opened. //! A reference of the most recently connected camera is stored in the registry. //! The mode is used to select how the dialog is handled. //! //!the <tt>mode</tt> is used to select how the dialog is handled<br> //!the mode bits are: //! - 0 use registry if existing: tries to open the same device as last time //! - 1 open dialog //! - 2 open without configuration (internal usage only) //! //!so following modes make sense: //! - 1 use registry, if it failed error is returned, no GUI opened //! - 2 always open dialog //! - 3 use registry, if it failed open the GUI dialog //! //!The parent is a HWND window handle. //! \return the return value is the number of opened cameras: therefore <=0 means FAILED. SR_API(int) SR_OpenDlg(SRCAM* srCam, int mode, HWND parent); //!Seeks for all visible devices and opens them all. //!the caller gives a srCam array with size num. //! \n\intDoc{function} //! \return the return value is the number of opened cameras: therefore <=0 means FAILED. SR_API(int) SR_OpenAll(SRCAM* srCam, unsigned int numSrCam, DWORD inAddr, DWORD inMask);


    • 편집됨 뉴비_코더 2013년 2월 15일 금요일 오전 8:22
    2013년 2월 15일 금요일 오전 7:56


  • 함수의 스텍 프레임을 현재 개발하는 모듈특성(윈도우즈 일반 응용 프로그램이냐, 윈도우즈 DLL 형식이냐,

    리눅스용이냐)에 따라서 다르게 사용하려고 조건부 컴파일을 사용했네요.


    스텍 프레임은 함수가 호출될때, 지역 변수나 인자를 어떻게 스텍에 배열하고 관리할것이에 대한

    규약이며 자세한 사항은 아래에 링크해드린 자료를 참고하시기 바랍니다.


    • 답변으로 제안됨 Yonghyun KimMVP 2013년 2월 28일 목요일 오전 12:45
    • 답변으로 제안 취소됨 Yonghyun KimMVP 2013년 2월 28일 목요일 오전 12:45
    • 답변으로 제안됨 Yonghyun KimMVP 2013년 2월 28일 목요일 오전 12:45
    • 답변으로 표시됨 Jina LeeModerator 2013년 3월 4일 월요일 오전 12:14
    2013년 2월 15일 금요일 오후 2:57