preprocessor stuff

Is there a way to detect if a system is using the /proc/ directory at all?
I want to avoid detecting this in the runtime code because it would eat a little time which would be more noticeable on older computers.

The reason I need this is so I can begin adding a secondary OS to some functions that have been written only for windows so far but I don't want to be writing too many if statements. My GUI relies on wxWidgets but wxWidgets does not support process hacking to any extent - It's a general purpose hacking tool I'm making.

At the moment my functions look like this:
1
2
3
4
5
6
7
8
9
function ( args... )
{
#ifdef __MSW__
// Do windows actions
#else
// Blank out returning variable/s
#endif
return variable;
}
Last edited on
Nobody gonna reply then?
I want to avoid detecting this in the runtime code because it would eat a little time which would be more noticeable on older computers.


If the amount of time to check for the existence of the directory /proc is noticeable, you're running on a computer that pre-dates the existence of the /proc directory, so it doesn't matter anyway.
Last edited on
Well I haven't actually tried on an old computer yet because I'm still trying to set up my environment variables but the programme grabs a new handle every time it set's about reading and/or writing memory - that would be fine if I was using a whole buffer at a time but the codelist format I made supports individual addresses of sizes 8, 16, 32 and 64 only so anything I can do to ensure maximum speed is desirable. Further more my hacking function is recursive on both tree items and their individual codelists so it can have more calls to itself to process when a test returns true and since the minimum speed is every 0.5 seconds maximizing this speed enhancement is essential.
If it weren't for the hacking function I wouldn't need to care.
You can build the code for each target platform (using autoconf/automake) and have the config script detect the details of the platform. It would then build the code using the features of that platform.

Alternatively, you can drive the features off a config file. You'd need some kind of install/setup process that determines the correct config for the platform. When the app starts, it reads the config file and decides how to proceed on that platform.

If you want to distribute binaries, you need to use the latter. If you distribute source, you can use the former.
Last edited on
Thanks, I distribute binaries and source so it is gonna have to be the latter, I'll have to use more targets in my project and simply add variables to declare at compile time.
Topic archived. No new replies allowed.