2013-07-01ãã1ã¶æéã®è¨äºä¸è¦§
rubyã§keyã®è¡ã®ç½®ãæã f=open("test1.txt"); a=Hash.new(); f.readlines.each{|i| i.chomp!; j=i.split(" ") a[j[0]+" "+j[1]]=i; # puts i; } f2=open("test2.txt"); f2.readlines.each{|i| i.chomp! j=i.split(" ") if a.has_key?(j[0]+" "+j[1]) then â¦
JNAã使ã£ã¦c++ã®ã·ã£ããã«é¢æ°ã¨é£æºï¼ c_shuff_test.scala import com.sun.jna.Library; import com.sun.jna.Native; import com.sun.jna.NativeLibrary; object c_shuff_test{ def main(args: Array[String]): Unit={ val lib=NativeLibrary.getInstanceâ¦
scalaããjnaã§c++é¢æ°ã使ãã å°ãã¯ã¾ã£ãï¼ãã¤ã³ãã¯é¢æ°ã«extern "C" ãã¤ãããã¨ï¼ C++ã§ã¯ãé¢æ°ã®ãªã¼ãã¼ãã¼ãï¼å¤éå®ç¾©ï¼ãªã©ãåå 㧠é¢æ°åã§é¢æ°ãç¹å®ã§ããªãï¼èå¥åãã¤ããããï¼ãããã§ãCæ¹å¼ã®é¢æ°åã¨ãã¦å®£è¨ãã¦ããï¼ http://â¦
cpp_test.scala import com.sun.jna.Library; import com.sun.jna.Native; import com.sun.jna.NativeLibrary; object cpp_test{ def main(args: Array[String]): Unit={ var a=Array(1.0,2.0,3.0); println("Input"); a.foreach{println} val lib=NativeLibâ¦
scalaããcã®é¢æ°ããã³å ç©ãè¨ç®loop.c #include<stdio.h> #include<stdlib.h> #include<math.h> #include"loop.h" int loop2(double* v1, double* v2,int n){ double tmp=0; int i; for(i=0;i</math.h></stdlib.h></stdio.h>
ã¯ããã¦Cè¨èª .hãã¡ã¤ã«ã®æå³ãç解ããï¼ cã®ãããã¼ãã¡ã¤ã«ã®æå³ http://www.geocities.jp/ky_webid/ProgrammingPlacePlus/c/023.html ãã¤ã³ãã¯, åãã¡ã¤ã«ã§é¢æ°å®£è¨ãããªãã¨é¢æ°ã使ç¨ã§ããªã âããã.hãã¡ã¤ã«å®æ ã¯ï¼.cãã¡ã¤ã«ã§å®ç¾©ãâ¦
ã¾ããæ®éã«ãã¦ã³ãã¼ããã㨠wget https://maven.java.net/content/repositories/releases/net/java/dev/jna/jna/3.5.2/jna-3.5.2.jar ã¨ã©ã¼: `maven.java.net' ã®è¨¼ææ¸ã¯ä¿¡ç¨ããã¾ããã ã¨ã©ã¼: `maven.java.net' ã®è¨¼ææ¸ã®çºè¡è ãä¸æã§ããã¨ãªâ¦
ï¼ï¼ï¼ã¾ãæºåã Cè¨èªã®ãã¤ãããã¯ãªã³ã¯ã©ã¤ãã©ãª(dll)ãä½ã #include<stdio.h> void test_hello(char* v){ printf(v); } dllåãã gcc -c test_hello.c gcc -shared -o test_hello.dll test_hello.o å®è¡ç¨ããã°ã©ã void main(){ test_hello("This is test</stdio.h>â¦