Version 3 (modified by 17 years ago) (diff) | ,
---|
Application development tips
Cross-platform functions
Most POSIX calls are supported on Unix and Windows. For areas that are different (e.g. scanning directories) BOINC supplies some generic functions with implementations for all platforms. Similar code may be available from other open-source projects.
- double dtime()
- return Unix time with fractional seconds
- double dday()
- return Unix time at start of this day
- void boinc_sleep(double)
- sleep for given period
- read_file_string(const char*, string)
- read file into string
etc. See lib/util.h and lib/filesys.h for others.
Windows-specific issues
- The set of 'standard' DLL differs somewhat among 9X/NT/2000/XP. To avoid crashing because a DLL is missing, call
::LoadLibrary()
and then get function pointers. - Visual Studio: set 'Create/Use? Precompiled Header' to 'Automatically Generate' (
/YX
) in C/C++ Precompiled Header project properties. - Visual Studio: change 'Compile As' to 'Compile as C++ Code (
/TP
)' in C/C++ 'Compile As' project properties.
Unix-specific issues
Several BOINC projects have experienced application crashes that turned out to be stack overflow. This can be fixed by calling:
rlimit rlp; getrlimit(RLIMIT_STACK, &rlp); rlp.rlim_cur = rlp.rlim_max; setrlimit(RLIMIT_STACK, &rlp);
before initializing BOINC.
C/FORTRAN
The BOINC API is implemented in C++. Information about using it from C and FORTRAN is here.
Compression
If you release new versions frequently, have a large executable, and want to conserve server bandwidth, you may want to compress your executable. The best way to do this is with Ultimate Packer for eXecutables (UPX).