Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C++ Libraries / January 2004

Tip: Looking for answers? Try searching our database.

Building DLL, please help!!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeoff - 26 Dec 2003 02:54 GMT
Hi,All

I have a question on how to build a universal DLL(Dynamic
Linking Library)or Lib(static library), which could be
used both in Debug and Release verisons. As i know,
edition of the application which invokes the library must
be the same with DLL. The application in Debug only works
with the DLL in Debug, otherwise the Release is the same.

Would you please give me some advice?

Thanks ahead,

Jeoff
Mihajlo Cvetanovic - 26 Dec 2003 10:15 GMT
> I have a question on how to build a universal DLL(Dynamic
> Linking Library)or Lib(static library), which could be
> used both in Debug and Release verisons. As i know,
> edition of the application which invokes the library must
> be the same with DLL. The application in Debug only works
> with the DLL in Debug, otherwise the Release is the same.

It isn't necessary to match apps and dlls but it's a Good Thing To Do.
If it will never happen a situation where one side allocate memory and
the other free it, and if none of the sides relies on memory appart
from what it gets via function arguments then there shouldn't be any
problems (if I'm wrong somebody please correct me).

To put it simply if your dll does malloc/new then it must free/delete.

If it is really necessary to pass buffer management to the other side
then there should be a function from buffer creator's side available
to buffer receiver for buffer deallocation.

In another words if there is a function in your dll:

char* CreateNewBuffer(void);

ther there should be as well:

void DeleteBufferCreatedInThisDll(char*);
Tony Nassar - 03 Jan 2004 15:39 GMT
I'm not sure this is correct. If you're using VS 6.0, then there is a
settings for each DLL and EXE called something like "Link statically" or
"Link dynamically", i.e., "link this module statically with the C runtime
library" or "link this module with the stub library, and load the DLL
version of the C runtime library at runtime." If you build all your modules
with the latter, then there will be only one memory manager (and only one
heap) at runtime, and a DLL *does not* have to free what it created.

> To put it simply if your dll does malloc/new then it must free/delete
Mihajlo Cvetanovic - 04 Jan 2004 16:33 GMT
True, but sometimes a programmer starts playing with compiler/linker
options, and finds out (or worse it doesn't find out) about new "bugs"
never seen before. This is the safe way, or "best programming
practice". Or in biblical terms: "I'm Alfa and Omega, your Constructor
and Destructor!" ;-)

> I'm not sure this is correct. If you're using VS 6.0, then there is a
> settings for each DLL and EXE called something like "Link statically" or
[quoted text clipped - 5 lines]
>
>>To put it simply if your dll does malloc/new then it must free/delete

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.