Using C++ dll having header file in C#

Announcements and discussion for PInvoke

Using C++ dll having header file in C#

Postby chaitu18 » Tue Jan 15, 2013 6:45 am

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: Select all
#pragma once
#define DAILY_PERIOD 24*60
#define MIN_PERIOD 1

#ifdef API_DLL
#define METHOD_TYPE __declspec(dllexport)
#define METHOD_TYPE __declspec(dllimport)

struct Quote {
unsigned long Date;
float Price;
float Open;
float High;
float Low;
float Volume;
float OpenInterest;

class METHOD_TYPE CMinuteApiCallback

virtual int quote_notify( const char* symbol, int interval, int nMaxSize, Quotation *pQuotes, unsigned long echo)=0;


class METHOD_TYPE CMinuteApi

int Initialise(char *serialkey, CMinuteApiCallback* callback);

int GetQuote(char * symbol, int periodicity, unsigned long lasttimeupdate, unsigned long echo);

int DeleteQuote(char * symbol, int periodicity);


So please let me know how can I call all these methods in my C# program. c# Example of above code is highly appreciated.Thanks in advance.
Posts: 1
Joined: Tue Jan 15, 2013 6:39 am

Postby Chris.Allen » Wed Jan 16, 2013 4:17 pm

You are *much* better off asking this question here:

tag it with: C# interop
Posts: 579
Joined: Thu Mar 12, 2009 4:17 pm

Return to PInvoke.Net

Who is online

Users browsing this forum: No registered users and 1 guest