Using C++ dll having header file in C#

Discussion in 'C#' started by chaitu18, Jan 14, 2013.

  1. chaitu18

    chaitu18 New Member

    Joined:
    Jan 14, 2013
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    I am totally new in c++ and I want to use C++ dll (having header file) in c# program.

    please find below header file.

    Code:
    #pragma once
    #define DAILY_PERIOD 24*60
    #define MIN_PERIOD   1
    
    #ifdef API_DLL 
    #define METHOD_TYPE __declspec(dllexport)
    #else
    #define METHOD_TYPE __declspec(dllimport)
    #endif
    
    struct Quote {
            unsigned long Date;
                        float   Price;
                        float   Open;
                        float   High;
                        float   Low;
            float   Volume;
            float     OpenInterest;                     
                 };
    
    
    
    class METHOD_TYPE CMinuteApiCallback
    {
    public:     
    
        virtual int quote_notify( const char* symbol, int interval, int nMaxSize, Quotation *pQuotes, unsigned long echo)=0;
    
    };
    
    
    class  METHOD_TYPE CMinuteApi
    {
    public:
    CMinuteApi(void);
    
    int Initialise(char *serialkey, CMinuteApiCallback* callback);
    
    int GetQuote(char * symbol, int periodicity, unsigned long lasttimeupdate, unsigned long echo);
    
    int DeleteQuote(char * symbol, int periodicity);
    
    ~CMinuteApi(void);
    };
    
    So please let me know how can I call all these methods in my c# program.

    thanks in advance
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice