manual memory management

Rob T rob at ucora.com
Wed Jan 9 12:03:17 PST 2013


On Wednesday, 9 January 2013 at 03:05:34 UTC, H. S. Teoh wrote:
> I haven't been screaming yet because (so far) I haven't gotten 
> to
> writing applications that need dynamic loading in D. But I did 
> tell
> myself that I will be screaming when I do get to it, because 
> it's a pain
> to have to recompile the entire application just to add a 
> single addon.

Unfortunately for me, I'm getting to that point.

>
>> If there's another better way, I'd sure like to know about it!
> [...]
>
> Another way, yes. Better, I don't know. You *could* load 
> plugins as
> separate processes and communicate via some kind of IPC 
> mechanism, like
> Unix pipes. But that's a royal pain (requires serialization /
> deserialization, with the associated overhead, and a network 
> stack or
> equivalent, just to interface with each other).
>
>
> T

The messaging concept does have some advantages. For example, if 
your external "plugin" fails for any reason (for example due to a 
segfault), the rest of your main application can continue 
operating just fine. There are other advantages, such as 
distributed processing, but if you can benefit from those 
advantages depends entirely on what you are attempting to 
achieve. The simplest use case that gives you a good subset of 
the main advantages, is through runtime loaded plugins.

In my case, I will making use of both methods, but I really 
prefer having the plug-in capability to start with.

--rt


More information about the Digitalmars-d mailing list