]> git.sur5r.net Git - cc65/blobdiff - include/modload.h
Fixed gcc compiler warning (#867)
[cc65] / include / modload.h
index b04ae70541048241dce8b0a799b26651251dc791..421641a90239f664490a1f152e7c70b9dd16a233 100644 (file)
@@ -34,8 +34,8 @@
 
 
 /* Exports structures and functions to load relocatable o65 modules at
- * runtime.
- */
+** runtime.
+*/
 
 
 
 
 
 /* The following struct is passed to the module loader. It contains stuff,
- * the loader needs to work, and another area where the loader will place
- * informational data if it was successful. You will have to check the return
- * code of mod_load before accessing any of these additional struct members.
- */
+** the loader needs to work, and another area where the loader will place
+** informational data if it was successful. You will have to check the return
+** code of mod_load before accessing any of these additional struct members.
+*/
 struct mod_ctrl {
-    /* Parameters passed into the loader routine. The second pointer
-     * (callerdata) is an opaque pointer that may be used by the caller to
-     * pass data through to the read routine. The read routine is used by the
-     * loader to load any required data. There are several calls where the
-     * read routine is called with a size of 1, so you may choose to make this
-     * a special case when implementing read().
-     */
-    unsigned char   (*read) (struct mod_ctrl*, void* buffer, unsigned size);
-    void*           callerdata;
+    /* Parameters passed into the loader routine. The member callerdata
+    ** is an opaque 16 bit datatype that may be used by the caller to
+    ** pass data through to the read routine. The read routine is used by the
+    ** loader to load any required data. There are several calls where the
+    ** read routine is passed a count of 1, so you may choose to make this
+    ** a special case when implementing read(). The read() should return the
+    ** number of bytes actually read. If the return value differs from the
+    ** passed count, this is considered an error.
+    ** NOTE: read() is designed so that the POSIX read() routine can be used
+    ** for this vector, if you're loading from disk.
+    */
+    int __fastcall__  (*read) (int callerdata, void* buffer, unsigned count);
+    int               callerdata;
 
     /* Parameters set by the loader routine */
-    void*           module;             /* Pointer to module data */
-    unsigned        module_size;        /* Total size of loaded module */
-    void*           code;               /* Pointer to code segment */
-    unsigned        code_size;          /* Size of code segment */
-    void*           data;               /* Pointer to data segment */
-    unsigned        data_size;          /* Size of data segment */
-    void*           bss;                /* Pointer to bss segment */
-    unsigned        bss_size;           /* Size of bss segment */
+    void*             module;           /* Pointer to module data */
+    unsigned          module_size;      /* Total size of loaded module */
+    unsigned          module_id;        /* Module id */
 };
 
 
 
-unsigned char mod_load (struct mod_ctrl* ctrl);
+unsigned char __fastcall__ mod_load (struct mod_ctrl* ctrl);
 /* Load a module into memory and relocate it. The function will return an
- * error code (see below). If MLOAD_OK is returned, the outgoing fields in
- * the passed mod_ctrl struct contain information about the module just
- * loaded.
- */
-
-void mod_free (struct mod_ctrl* ctrl);
-/* Free a loaded module. */
+** error code (see below). If MLOAD_OK is returned, the outgoing fields in
+** the passed mod_ctrl struct contain information about the module just
+** loaded.
+*/
+
+void __fastcall__ mod_free (void* module);
+/* Free a loaded module. Note: The given pointer is the pointer to the
+** module memory, not a pointer to a control structure.
+*/