라벨이 klibc인 게시물 표시

OS/2 codes: How to override standard functions in kLIBC

Sometimes there is a time when it is needed to override the functionality of some functions. To do this, at least two ways can be considered. Macros First is to use macros. For examples, if you want to override pipe(), then you can write the codes like this. Colored By Color Scripter ™ 1 2 3 4 5 6 7 8 9 10 #include  <io.h> int  my_pipe( int  *ph) {     some_codes;      return  (pipe)(ph); } #define  pipe(ph) my_pipe(ph) At line 7, a parenthesis is used to prevent pipe() from being expaned to my_pipe() by a macro. This way has an advantage that this can be applied to all the functions. But this has a disadvantage that this can be applied only locally. If you want to apply globally, then you should create a header for a macro and all the sources should include that header. Alias The other way is to use alias. kLIBC provides aliases for standard functions, which do not ha...

OS/2 codes: How to link statically against kLIBC

Originally, it is not supposed to link statically against kLIBC. That is, all the programs linked against kLIBC will depend on libcxxx.dll. Neverthelss, it is not impossible. Do the following. gcc -Zomf -static -o test.exe test.c -lc_omf386 Then, you can get test.exe without dependency on libcxxx.dll.

Porting to OS/2: Useful articles

1. kLIBC articles 1.1. FAQ http://trac.netlabs.org/libc/wiki/Faq 1.2. UnixPenthouseApartment http://trac.netlabs.org/libc/wiki/UnixPenthouseApartement 1.3. kNIXPorting http://trac.netlabs.org/libc/wiki/kNIXPorting 1.4. kOptions http://trac.netlabs.org/libc/wiki/kOptions 2. EMX articles The following articles are primarily for EMX. But kLIBC was inherited from EMX, so kLIBC shares many parts with EMX although there are some differences between them. By this, it's worth reading the following articles. 2.1. UNIX/POSIX to emx-OS/2 Porting Guide http://posix2.sourceforge.net/guide.html 2.2. Alexander Mai's The un*x to OS/2-EMX Porting FAQ http://www.edm2.com/index.php/The_un*x_to_OS/2-EMX_Porting_FAQ 2.3. Porting from Unix platforms http://www.edm2.com/index.php/Porting_from_Unix_platforms 2.4. Tips & Tracks for porting applications http://www.edm2.com/index.php/Tips_%26_Tricks_for_porting_applications