0

I have created a dll and I want to use its functions in my other projects using Visual Studio 2008.Kindly Help...:icon_sad:

1
Contributor
1
Reply
3
Views
6 Years
Discussion Span
Last Post by EMT
0

Initially in the dll project I was using .c code and had used

#ifdef __cplusplus 
extern "C"
{
  __declspec(dllexport) void MyFunctionName();
}
#endif

in both the .h and .c files. Why cannot say but the solution was not generating the .lib But, when i commented the same and compiled the dll project the .lib also got generated and I can use it conveniently.
When searched further found that the syntax I was using is incorrect, it should be as follows...

#ifdef __cplusplus 
extern "C"
{
#endif
  __declspec(dllexport) void MyFunctionName();
#ifdef __cplusplus 
extern "C"
}
#endif

This code works fine and gives the .dll as well as .lib(object file library):icon_lol:

Edited by EMT: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.