tags:

views:

87

answers:

2
+2  Q: 

how to use dll?

hello, i have have a program/project in vs2008 that uses a third party static lib. Now, it has come to my attention that i need to offer some api's via a dll. Apparently a thrid party program will use my dll via the apis i will provide.

Can anyone give me some direction as to what I need to do? would i need to just create a dll in vs2008 and just copy and paste my method logic in the apis that i provide?

are there any potential issues i need to worry about?

thank you

+2  A: 

I suggest you check out this MSDN tutorial on creating & using DLLs.

There are unfortunately many potential issues to think about. A very brief and by no means complete list of the ones that pop in to my head:

  • You need to be aware of potential errors passing CRT objects across DLL boundaries
  • If you allocate objects in one module and deallocate them in the other, your DLL and the client code must link to the same CRT
  • It is very important that you keep the interface seperate from the implementation in your DLLs header files. This means you often can't do thing like use std::string as function parameters, or even as private member variables.

If I think of more or find more links, I'll add them.

John Dibling
currently i use std::String everywhere in my code. but i reckon when i do the api iterfaces i would need to use const char * perhaps to do the same thing?
djones2010
John Dibling
A: 

There are a few steps, check out this example: Visual Studio 2008 - Creating DLL

Tommy