Section External - stop functions from being optimised out?

Jeremy Cowgar jeremy at cowgar.com
Tue Nov 11 14:47:13 UTC 2008


I've done this trick:

- make_alive <-
(
  `
  #if 0
  `;
  make_alive NULL;
  `
  #endif
  `;
);

- main <-
(
  make_alive;
  // rest of code
);

However, I get a strange error:

Depending pass: ..--SEMANTIC---------
Profil block not found, a first definition must to be before a first evaluation.
Sorry, it's a limit for this actual compiler.
Line 20 column 1 in IUP_BUTTON_ACTION(./iup_button_action.li):
	);

The actual function is:

- lisaac_iup_button_action ih:POINTER :INTEGER <-
(
  + ptr:POINTER;
  + self:SELF;

  ptr := `IupGetAttribute(@ih, "OOSELF")`:POINTER;
  self := CONVERT[POINTER, SELF].on ptr;
  "Calling button action:\n".print;
  self.block.value ih
);

Line 20, Column 1 is the "self.block.value ih"

Thanks for any help.

Jeremy

Quoting Jeremy Cowgar <jeremy at cowgar.com>:
> Greetings!
> 
> How can I stop the compiler from optimising an external function out of
> existance? Here is an example:
> 
> Section External
> 
>   - say_hello ih:POINTER :INTEGER <-
>   (
>     "Hello, World!\n".print;
>     `IUP_CLOSE`:INTEGER
>   );
> 
> Section Public
> 
>   - main <-
>   (
>     // code
>     `IupSetCallback(@control, "ACTION", say_hello)`;
>     // code
>   );
> 
> The external function "say_hello" is never used directly, thus the compiler
> is removing it from the compiled code. How can I tell the compiler to
> keep say_hello?
> 
> Thanks,
> 
> Jeremy
> 
> _______________________________________________
> Lisaac-devel mailing list
> Lisaac-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/lisaac-devel



More information about the Lisaac-devel mailing list