AROS World Exec
General => Help => Topic started by: serk118uk on October 27, 2021, 04:47:39 AM
-
Hi ppl,
I have looked at aros tree examples codes for help and to be fair i coulld't understand how #pragma libcall made on on AROS,
mostly used as
#ifndef __AROS__
#pragma libcall AmIDE_API_Base AmIDE_API_GetClass 1e 0
#endif
but than how its done in AROS, gcc dont complain while compiling, i still get AmIDE_API_GetClass missing at main compile so "#pragma libcall AmIDE_API_Base AmIDE_API_GetClass 1e 0" not AROS friendly i guess ..
-
I'm not familiar with this notation. What you are trying to achieve?
-
What you are trying to achieve?
deadwood remember the plugin/module we compiled other day (thanks to your help) and now
i am actualy trying to load that plugin/module at main.c
Function AmIDE_API_GetClass is in sasc.module.c and than defined in
modules/api/clib/amide_api_protos.h
modules/api/pragmas/amide_api_pragmas.h
modules/api/proto/amide_api.h
and LoadModules function calls that function from main.c
i have not made lib calls before so i am bit lost..
main.c
BOOL LoadModules(struct FileInfoBlock *fib, STRPTR pattern)
{
char modulepath[256];
struct IClass *mod_class;
struct str_modules *module;
#ifdef DEBUG
DEBUG_MAKRO
#endif
sprintf(modulepath, "modules/%s", (STRPTR) &(fib->fib_FileName));
if(MatchNoCase(modulepath, pattern) == 1)
{
// Speicher für die Struktur holen
module = (struct str_modules *)calloc(1, sizeof(struct str_modules));
if(!module) return(TRUE);
// Den Pfad des modules nun in die Struktur schreiben
strcpy(module->module_path, modulepath);
// Jetzt die Library öffnen
module->libbase = OpenLibrary(modulepath, 0);
if(!module->libbase) return(TRUE);
// LibBase umkopieren
AmIDE_API_Base = module->libbase;
// Klasse holen
mod_class = AmIDE_API_GetClass(); //<<<<<this is where its used
if(!mod_class) return(TRUE);
// Objekt erzeugen
module->lib_object = NewObject(mod_class, NULL, TAG_DONE, NULL);
if(!module->lib_object) return(TRUE);
// Jetzt die Struktur an die Liste hängen
DoMethod(LS_AmIDE_Modules, MUIM_List_InsertSingle, module, MUIV_List_Insert_Bottom, TAG_DONE);
}
return(TRUE);
}
-
Ok, I understand. In case of AROS it is best to use portable macros to make these calls. I'm now writing from memory so there can be bugs:
mod_class =AROS_LC0(void *, AmIDE_API_GetClass,
struct Library *, (AmIDE_API_Base), 5, AmIDE_API );
#include <aros/libcall.h>
-
Ok, I understand. In case of AROS it is best to use portable macros to make these calls. I'm now writing from memory so there can be bugs:
mod_class =AROS_LC0(void *, AmIDE_API_GetClass,
struct Library *, (AmIDE_API_Base), 5, AmIDE_API );
#include <aros/libcall.h>
Amazing you are, worked thanks
-
Lucky shot :D
Note that argument '5' in the macro defines the position of function. First user function has position 5.