Hi
My current editor is Dev-Cpp 4.9.2.2 .My test program which runs fine looks like
dll.h
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef __cplusplus
extern "C"
{
#endif
__declspec(dllexport) void HelloWorld();
#ifdef __cplusplus
}
#endif
And dll.cpp
#include"dll.h"
void HelloWorld ()
{
MessageBox (0, "This is a sample application!\n", "Hi", MB_ICONINFORMATION);
}
This code runs fine. Now i tried the same thing with my program where i'm using boostlib.
so my dll.h changed to
/*List of header files */
using namespace boost;
using namespace std;
//Contains vertex properties of a graph
struct Vertex_Prop
{
string name;
};
//Contains edge properties of a graph
struct Edge_Prop
{
int weight;
};
typedef graph_traits <adjacency_list<> >::vertex_descriptor Vertex;
struct Graph_Prop
{
std::map<string,Vertex> nodes;
};
typedef adjacency_list <setS, vecS, bidirectionalS, Vertex_Prop, \
Edge_Prop,Graph_Prop > Graph;
[B]#ifdef __cplusplus
extern "C"
{
#endif
__declspec(dllexport) int CreateGraph(Graph &g);
#ifdef __cplusplus
}
#endif
[/B]
This code gives a linking error. Even if you are not well versed with boost i just want to know what is the correct way to write code for bold part if i want to create a dll of this. The above code is running fine when i have created exe or a console application for this. Where in the header i have simply declared the function without any __declspec(dllexport).
Kindly help