dll.h 1.3 KB

12345678910111213141516171819202122232425262728
  1. #ifndef __DLL
  2. #define __DLL
  3. #include <default.h>
  4. #define __DLL_SIGNATURE 0x444C4C20
  5. typedef struct{unsigned long Signature,ID;unsigned short major,minor;void*jump_table[];}__DLL_interface_struct;
  6. extern __DLL_interface_struct*__DLL_interface_ptr;
  7. extern void*__DLL_body_ptr;
  8. /* Begin Auto-Generated Part */
  9. enum DLL_ErrorCodes{DLL_OK,DLL_NOTINGHOSTSPACE,DLL_NOTFOUND,DLL_LOCKFAILED,DLL_OUTOFMEM,DLL_ALREADYLOADED,DLL_WRONGVERSION};
  10. #define _DLL_call_attr(type,args,attr,index) (*(type(*attr)args)_DLL_entry(index))
  11. #define _DLL_call(type,args,index) (*(type(*)args)_DLL_entry(index))
  12. #define _DLL_entry(index) (__DLL_interface_ptr->jump_table[index])
  13. #define _DLL_glbvar(type,index) (*(_DLL_reference(type,index)))
  14. #define _DLL_reference(type,index) ((type*const)_DLL_entry(index))
  15. extern short LoadDLL(const char*,long,short,short)__ATTR_LIB_C__;
  16. extern void LoadDLLThrow(const char*,long,short,short)__ATTR_LIB_C__;
  17. extern void UnloadDLL(void)__ATTR_LIB_C__;
  18. #define DLL_EXPORTS ,{
  19. #define DLL_ID __DLL_interface_struct __DLL_interface __attribute__((__section__("_stl20")))={__DLL_SIGNATURE,
  20. #define DLL_IMPLEMENTATION ,(void*)-1L}};
  21. #define DLL_INTERFACE asm(".xdef _nostub_dll\n\t.xdef __ld_ignore_global_imports");
  22. #define DLL_VERSION ,
  23. /* End Auto-Generated Part */
  24. #endif