views:

414

answers:

3

Hi,

Up until now I am developing using Delphi 7. In order to pass f.e. TStringLists to my DLL's I use the FastShareMem unit as first unit in every program and dll I develop.

If I should migrate to Delphi-2010, Does FastShareMem still necessary ?

Thanks for any insight you may provide.

+1  A: 

No, use SimpleShareMem instead as first unit in your Application and DLL.

Delphi 2007 and above include now FastMM as default memory manager, which used by SimpleShareMem and no need to distribute any DLL with your application.

Mohammed Nasman
+4  A: 

Short answer: No, SimpleShareMem comes with Delphi 2010

Long answer: Yes, Delphi still has its own memory manager and memory claimed from one memory manager (exe) can not be returned to another (dll). But since Delphi 2006 Delphi comes with a new memory manager called FastMM which can do the same as FastShareMem and also does not require any extra dlls to be distributed. You need to use a unit called SimpleShareMem. FastMM also has other nice features you might want to check out. FastMM is also available for Delphi 7 BTW.

You don't need to use any of those tricks if you compile with runtime packages, since the memory manager is then shared. It also comes with the advantage of sharing the same types. No more TFont can not be assigned to TFont problems. Of course this does mean you have to distribute the runtime packages.

Lars Truijens
What I don't understand is that, if SimpleShareMem is so much better, why doesn't Delphi not include it as default? Now we have to make sure it is added in every program and dll ???The reason I don't use runtime packages is that I have several projects consisting of exe's and dll's. If I upgrade f.i. to a new version of the Development Express components, I need to recompile every exe and run time package to my users, no ? Using dll, I just recompile the dll when I want to work on it. Mind you, I never used run time packages in all my years of programming, so I might be wrong here.
Edelcom
Because sharing memory managers comes with some overhead. An overhead most applications could do without. That is why it is optional. It also has some implications on how the dll and the exe can be used. You can read about that in the help.
Lars Truijens
Only if the public interface of a runtime package changes is when you need to recompile any project that is using that runtime package. How often that is depends on you. If you don't use runtime packages you need to recompile those projects anyway or they simply won't contain those changes. Runtime packages also saves you memory and diskspace when certain parts are used by more then 1 project.
Lars Truijens
+1  A: 

See this SO question and my answer there...

François