[ooc-compiler] Suggestion: Procedure renaming in interface modules
Brought to you by:
mva
|
From: Stewart G. <sgr...@ip...> - 2002-02-12 23:27:56
|
Hi Folks, I think it would be useful to be able to rename procedures in INTERFACE modules. C has a flat namespace, so C libraries often have procedure names with convoluted prefixes. Basically, the idea would be to optionally map a procedure name in an interface module to a different name which would be used when generating the call to that procedure. For example, the current GSL.Mod has: PROCEDURE gsl_sf_bessel_J0* (x : LONGREAL) : LONGREAL; So to call this, I have to do: IMPORT GSL; ... GSL.gsl_sf_bessel_J0(arg) If this were declared in an interface module GSL:SF:Bessel.Mod, it would look like this: PROCEDURE J0* [ "gsl_sf_bessel_J0" ] (x : LONGREAL) : LONGREAL; So I can then do: IMPORT GSL:SF:Bessel; ... Bessel.J0(arg) The compiler knows that J0 is an alias for gsl_sf_bessel_J0, so it generates a call to the actual procedure, and not a procedure named J0. Component Pascal has a feature like this. I can't remember off-hand what system flags currently apply to procedures in interface modules, so the syntax might have to be slightly different. Cheers, Stewart |