bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

load directive - module parameters


From: Tim Murphy
Subject: load directive - module parameters
Date: Sun, 5 May 2013 12:23:36 +0100

One thing that's worth thinking about in advance about the load directive is whether there needs to be a way to pass parameters into modules.


In my case I need for the module to be able to know whether it's allowed to generate debug output or not. I can think of many other areas in which I might want to connect to an external resource like a web server or database or whatever and would need to provide the module with information.

load mymodule.so debug
load mymodule.so debug=1
load mymodule.so 1

Obvously this wouldn't work because load allows you do do this:

load fred.so bob.so alice.so

An unsympathetic answer would be:

DEBUG:=1
load mymodule.so

But imagine telling a programmer in any other language that this was how to instantiate a class or call a function?

Other possibilities:

load mymodule.so[1] fred.so[0]

Filenames can actually have [] characters in them so it's not very desirable.

If the answer is target specific variables then I give up but I will avoid saying why because it will only start a debate. :-)


I also notice that there is a setup() but no teardown() or equivalent.  Any module which might have some state will need such a hook so that it can deallocate resources cleanly.



Cheers,

Tim



--
You could help some brave and decent people to have access to uncensored news by making a donation at:

http://www.thezimbabwean.co.uk/friends/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]