4 * Definitions for DLLLib
16 /*----- External dependencies ---------------------------------------------*/
30 /*----- Type definitions for DLLs -----------------------------------------*/
32 typedef void *dll; /* What a DLL handle looks like */
34 typedef struct /* An external DLL table */
36 char *name; /* Name of DLL to load */
37 int version; /* Minimum acceptable version */
38 char *entryNames; /* Pointer to entry name table */
39 void *branchTable; /* Pointer to branch table to fill */
43 typedef struct /* A DLL information structure */
45 dll d; /* The handle of the DLL */
46 char *name; /* The DLL's textual name */
47 int version; /* The DLL's version number */
48 char *author; /* The name of the DLL's author */
49 unsigned instSize; /* Size of the DLL's instance vars */
53 /*----- Interface to DLLManager SWIs --------------------------------------*
55 * The sharper eyed amongst you may have noticed that DLL_Prologue doesn't
56 * have an entry point here. This is for several reasons:
58 * 1. It's not a very safe call to make if you don't know what you're doing.
59 * Then again, nor are any of the others.
61 * 2. It's not all that useful unless you're writing in assembler, in which
62 * case you can call the SWI directly.
64 * 3. Hopefully, the cdll program can generate all the code you'll ever need
65 * which calls DLL_Prologue, and you'll never need to mess about with it.
67 * Several of the calls listed here suffer badly from lack of usefulness.
68 * The only ones that you're really likely to want to use are dll_nameApp,
69 * dll_info and dll_findEntry.
72 os_error *dll_find(const char */*name*/, int /*version*/, dll */*d*/);
73 os_error *dll_findFromTable(const dll_table */*table*/, int /*entries*/);
74 os_error *dll_load(void */*buffer*/, const char */*name*/);
75 os_error *dll_lose(dll /*d*/);
76 os_error *dll_appDying(void);
77 os_error *dll_giveCLibData(void */*data*/);
78 os_error *dll_findCLibData(void **/*p*/);
79 os_error *dll_instanceVars(void */*buffer*/, int */*size*/, int */*magic*/);
80 os_error *dll_setInstanceVars(dll /*d*/, void */*workspace*/);
81 os_error *dll_appData(void);
82 os_error *dll_readStackPtr(int */*sp*/);
83 os_error *dll_setStackPtr(int /*sp*/);
84 os_error *dll_nameApp(const char */*name*/);
85 os_error *dll_info(dll /*d*/, dll_infostr */*i*/);
86 os_error *dll_findEntry(dll /*d*/, const char */*name*/,
87 void (**/*entry*/)());
88 os_error *dll_saveHandle(int */*handle*/);
89 os_error *dll_restoreHandle(int */*handle*/);
90 os_error *dll_findInstanceVars(dll /*d*/, void **/*addr*/);
91 os_error *dll_registerAppEntryTable(void (**/*btable*/)(), char */*names*/);
92 os_error *dll_findAppEntry(char */*name*/, void (**/*func*/)());
93 os_error *dll_setExtensionTable(void (**/*btable*/)(), char */*names*/);
95 /*----- Doing nothing at all, but without warnings! -----------------------*/
97 #define _dll_nothing ((void)(0))
99 /*----- Registration with DLLManager --------------------------------------*/
103 void _dll_appspace(void);
104 void _dll_clibdata(void);
105 #define _dll_setname(name) (void)dll_nameApp(name)
109 #define _dll_appspace(x) _dll_nothing
110 #define _dll_clibdata(x) _dll_nothing
111 #define _dll_setname(name) _dll_nothing
115 /*----- Handling *commands ------------------------------------------------*/
119 int _dll_system(const char */*command*/);
120 int _dll_ksystem(const char */*command*/, int /*chain*/);
121 os_error *_dll_oscli(const char */*command*/);
122 os_error *_dll_starttask(const char */*command*/);
126 #define _dll_system(x) system(x)
127 #define _dll_ksystem(x) _kernel_system(x)
128 #define _dll_oscli(x) os_cli(x)
129 #define _dll_starttask(x) wimp_starttask(x)
133 /*----- Handling of extension DLLs ----------------------------------------*/
135 dll _dll_loadExtension(const char */*name*/);
136 void _dll_freeExtension(dll /*d*/);
138 /*----- setjmp and longjmp support ----------------------------------------*/
142 int _dll_setjmp(void);
143 void _dll_longjmped(int /*sp*/);
147 #define _dll_setjmp(x) (0)
148 #define _dll_longjmped(x) ((x)=(x))
152 /*----- Other miscellaneous calls -----------------------------------------*/
156 void _dll_giveMemory(void);
160 #define _dll_giveMemory(x) _dll_nothing
164 /*----- External names for extentry functions -----------------------------*/
168 #define _dllEntry(name) _dllEntry_ ## name
172 #define _dllEntry(name) name
178 #define _extEntry(name) _extEntry_ ## name
183 #define _extEntry(name) name
184 #define _dll_static static