linux/kernel/module language feature: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: linux/kernel/module language feature
| Old | New | Line | |
|---|---|---|---|
| 1 | + | # Overview | |
| 2 | + | ||
| 3 | + | The purpose of this page is to give a specification of a FPC feature allowing writing (Linux) kernel modules using FPC. The main purpose is to an easy syntax hiding all the details of sectioning and linking. The ultimate goal of these wiki pages is to provide a proposal for a future support of natural linux kernel module support in particular and driver support in general (for win32...) A dedicated page module language feature is intended to provide specification for this future support. | |
| 4 | + | ||
| 5 | + | # Language enhancement | |
| 6 | + | ||
| 7 | + | This proposal is based on adding a new keyword **module** triggering a special linking mechanism. Please note that this keyword **module** is already recognized by GPC for other purpose. The concept is very similar, however the use is different. Indeed, GPC modules are intended to be linked to programs, however these featured modules are intended to be loadable by the kernel. The latter doesn't, of course, prevent the former. | |
| 8 | + | ||
| 9 | + | The easiest way to illustrate this is using the following example | |
| 10 | + | ||
| 11 | + | ``` pascal | |
| 12 | + | module kpmod; | |
| 13 | + | uses unit1, unit2,...unitn; | |
| 14 | + | const | |
| 15 | + | MODULE_NAME = 'kpmod'; | |
| 16 | + | type | |
| 17 | + | TType = some type; | |
| 18 | + | const | |
| 19 | + | aConst = a value; | |
| 20 | + | initialization | |
| 21 | + | {Module initialization code} | |
| 22 | + | printk(KERN_INFO + 'Module "%s" is being loaded'#10, MODULE_NAME); | |
| 23 | + | finalization | |
| 24 | + | {Module cleanup code} | |
| 25 | + | printk(KERN_INFO + 'Module "%s" is being unloaded'#10, MODULE_NAME); | |
| 26 | + | end. | |
| 27 | + | ``` | |
| 28 | + | ||
| 29 | + | # Working details | |
| 30 | + | ||
| 31 | + | --- | |
| 32 | + | *From the Free Pascal wiki, page "linux/kernel/module language feature", as it stood on 2020-01-26 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* | |
| 33 | + | Category: Linux | |
| 34 | + | Category: Proposals |
