Making a plugin for ML, problems

Started by scrax, July 02, 2012, 09:31:24 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

scrax

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?
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

coutts

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 ?

scrax

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...
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-