A Design Question lazarus / 62-General ---------------------------------------------------------------------- MathMan ยท 2022-03-17 11:14 Hello Free Pascal experts, I have a software design question. It is a bit convolutet, so pls bear with me - but I have a minimal compilable project attached, that might shed some light on my following rambling. Let's start from a standardised data format (e.g. by IEEE, OSI, you name it). This enables data exchange between different applications and even different functions within an application. Usually these standard formats are geared towards memory efficiency, but not towards computational efficiency. Which introduces conversion routines at the borders of applications and individual accessible functions within an application. I would like to develop a library that can be compiled - controled by a conditional define - to either include the necessary conversion on function entry or exit, or use the more efficient internal data format throughout. Of course I could do that with $ifdef, implement nearly everything in two variants, etc. Now comes the twist - I would like to avoid this, because 90% of the work will be the same. And I also want to achieve an implementation with only minimal interruptions by $ifdef - I admit that every interruption by $ifdef in a source makes it much harder for me to follow the main idea. I do have a solution available - see attached project - but I wonder if this could be done better, more elegant? Cheers, MathMan