I'm trying to make a plugin for ML o see how it works.
I've started from testplug, and changed a little to this:
#define PLUGIN_CLIENT
#include "plugin.h"
extern const char* CARD_DRIVE;
extern int transparent_overlay_hidden;
EXTERN_FUNC(MODULE_FUNC_INIT, struct plugin_descriptor *, somefunc) {
msleep(100);
beep();
FILE * f = FIO_Open(CARD_DRIVE "ML/DATA/overlay.dat", 0);
if (f != (void*) -1)
{
beep();
FIO_CloseFile(f);
FIO_RemoveFile(CARD_DRIVE "ML/DATA/overlay.dat");
transparent_overlay_hidden = !transparent_overlay_hidden;
redraw();
beep();
}
return 0;
}
But i have errors when compiling:
scraxplug.c: In function 'somefunc':
scraxplug.c:10:36: error: expected ')' before string constant
scraxplug.c:10:36: error: too few arguments to function 'FIO_Open'
scraxplug.c:15:29: error: expected ')' before string constant
make[2]: *** [scraxplug.o] Error 1
some hint?
Quote from: scrax on July 02, 2012, 09:31:24 PM
I'm trying to make a plugin for ML o see how it works.
I've started from testplug, and changed a little to this:
#define PLUGIN_CLIENT
#include "plugin.h"
extern const char* CARD_DRIVE;
extern int transparent_overlay_hidden;
EXTERN_FUNC(MODULE_FUNC_INIT, struct plugin_descriptor *, somefunc) {
msleep(100);
beep();
FILE * f = FIO_Open(CARD_DRIVE "ML/DATA/overlay.dat", 0);
if (f != (void*) -1)
{
beep();
FIO_CloseFile(f);
FIO_RemoveFile(CARD_DRIVE "ML/DATA/overlay.dat");
transparent_overlay_hidden = !transparent_overlay_hidden;
redraw();
beep();
}
return 0;
}
But i have errors when compiling:
scraxplug.c: In function 'somefunc':
scraxplug.c:10:36: error: expected ')' before string constant
scraxplug.c:10:36: error: too few arguments to function 'FIO_Open'
scraxplug.c:15:29: error: expected ')' before string constant
make[2]: *** [scraxplug.o] Error 1
some hint?
did you mean to say FIO_OpenFile ?
No, I think. Tried both but nothing...
the code compile right if used with "don't click me":
extern int transparent_overlay_hidden;
void run_test()
{
msleep(2000);
//~ while(gui_menu_shown()) msleep(100);
//~ msleep(2000);
//~ menu_benchmark();
//~ menu_save_all_items_dbg();
beep();
FILE* f = FIO_Open(CARD_DRIVE "ML/DATA/overlay.dat", 0);
if (f != (void*) -1)
{
beep();
FIO_CloseFile(f);
FIO_RemoveFile(CARD_DRIVE "ML/DATA/overlay.dat");
transparent_overlay_hidden = !transparent_overlay_hidden;
redraw();
beep();
}
}
Even without calling "extern const char* CARD_DRIVE;"
I suppose that I need to put something also for FIO_File but I've not yet figured what...