type  Tsetupfunc_mapping=record
        name:string;
        func:setupfunc;
      end;
const setupfunc_mapping:array[0..2] of Tsetupfunc_mapping=(
       (name:'setup_function_1';func:@setup_function_1),
       (name:'setup_function_2';func:@setup_function_2),
       (name:'setup_function_3';func:@setup_function_3));

Then search the name of the function you want to call in the table, then call the function in the "func" field.
Thanks, but the consts should be:
const setupfunc_mapping: array[0..2] of Tsetupfunc_mapping=(
        (name: 'setup_function_1'; func: setup_function_1),
        (name: 'setup_function_2'; func: setup_function_2),
        (name: 'setup_function_3'; func: setup_function_3));

However compiling with {$mode objfpc} I get the error:
** Error: Some fields coming before "name" weren't initialized
and it dosen't compile.
While with {$mode delphi} it compiles but with a simple warning:
** Warning: Some fields coming before "name" weren't initialized
The question now is how to get it compiling (and executing) without error using {$mode objfpc}?
Thanks!

ps
the code compiles and runs without warnings using Delphi.

--
Jilani KHALDI


_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to