OSDN Git Service

Update README
authora <a@b.c>
Thu, 22 Jun 2017 12:44:21 +0000 (14:44 +0200)
committera <a@b.c>
Thu, 22 Jun 2017 12:44:21 +0000 (14:44 +0200)
README.md
doc/pinkybar.1
doc/pinkybar.texi

index ebc78de..024f82f 100644 (file)
--- a/README.md
+++ b/README.md
@@ -824,9 +824,7 @@ By default I decided not to include Rust lang, but this doesn't mean you cannot
 ```rust
 #![crate_type = "staticlib"]
 
-extern crate libc;
-
-use libc::c_char;
+use std::os::raw::c_char;
 use std::ffi::CString;
 
 #[no_mangle]
@@ -846,7 +844,7 @@ pub extern fn Rfree(s: *mut c_char) {
 }
 ```
 
-Compile to object code with `rustc --emit=obj lib.rs`
+Compile to object code with `rustc --crate-type=staticlib lib.rs`
 
 **test.c**
 
@@ -858,15 +856,12 @@ extern void Rfree(char *);
 
 int main(void) {
   char *str = hello();
-
   printf("%s\n", str);
-
   Rfree(str);
-  return 0;
 }
 ```
 
-Compile with `gcc lib.o test.c -o test`
+Compile with `gcc liblib.a test.c -o test -lpthread -ldl`
 
 ---
 
index fd311d3..33944e7 100644 (file)
@@ -1662,9 +1662,7 @@ cannot do it by hand:
 \f[C]
 #![crate_type\ =\ "staticlib"]
 
-extern\ crate\ libc;
-
-use\ libc::c_char;
+use\ std::os::raw::c_char;
 use\ std::ffi::CString;
 
 #[no_mangle]
@@ -1685,7 +1683,8 @@ pub\ extern\ fn\ Rfree(s:\ *mut\ c_char)\ {
 \f[]
 .fi
 .PP
-Compile to object code with \f[C]rustc\ \-\-emit=obj\ lib.rs\f[]
+Compile to object code with
+\f[C]rustc\ \-\-crate\-type=staticlib\ lib.rs\f[]
 .PP
 \f[B]test.c\f[]
 .IP
@@ -1698,16 +1697,14 @@ extern\ void\ Rfree(char\ *);
 
 int\ main(void)\ {
 \ \ char\ *str\ =\ hello();
-
 \ \ printf("%s\\n",\ str);
-
 \ \ Rfree(str);
-\ \ return\ 0;
 }
 \f[]
 .fi
 .PP
-Compile with \f[C]gcc\ lib.o\ test.c\ \-o\ test\f[]
+Compile with
+\f[C]gcc\ liblib.a\ test.c\ \-o\ test\ \-lpthread\ \-ldl\f[]
 .PP
    *   *   *   *   *
 .SS Wish list
index 1ffde80..83eb558 100644 (file)
@@ -1472,9 +1472,7 @@ cannot do it by hand:
 @verbatim
 #![crate_type = "staticlib"]
 
-extern crate libc;
-
-use libc::c_char;
+use std::os::raw::c_char;
 use std::ffi::CString;
 
 #[no_mangle]
@@ -1494,7 +1492,7 @@ pub extern fn Rfree(s: *mut c_char) {
 }
 @end verbatim
 
-Compile to object code with @code{rustc --emit=obj lib.rs}
+Compile to object code with @code{rustc --crate-type=staticlib lib.rs}
 
 @strong{test.c}
 
@@ -1506,15 +1504,12 @@ extern void Rfree(char *);
 
 int main(void) {
   char *str = hello();
-
   printf("%s\n", str);
-
   Rfree(str);
-  return 0;
 }
 @end verbatim
 
-Compile with @code{gcc lib.o test.c -o test}
+Compile with @code{gcc liblib.a test.c -o test -lpthread -ldl}
 
 @iftex
 @bigskip@hrule@bigskip