Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use dll?

Tags:

c++

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

like image 752
djones2010 Avatar asked Dec 20 '25 00:12

djones2010


1 Answers

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.

like image 130
John Dibling Avatar answered Dec 22 '25 15:12

John Dibling



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!