Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -0,0 +1,2 @@
dyn.load("my/special/R/lib.so")
.Call("my_lib_fun", arg1, arg2)

View file

@ -0,0 +1 @@
.C("my_lib_fun", arg1, arg2, ret)

View file

@ -0,0 +1,26 @@
import net.java.dev.sna.SNA
import com.sun.jna.ptr.IntByReference
object GetDiskFreeSpace extends App with SNA {
snaLibrary = "Kernel32" // Native library name
/*
* Important Note!
*
* The val holding the SNA-returned function must have the same name as the native function itself
* (see line following this comment). This is the only place you specify the native function name.
*/
val GetDiskFreeSpaceA = SNA[String, IntByReference, IntByReference, IntByReference, IntByReference, Boolean]
// This Windows function is described here:
// http://msdn.microsoft.com/en-us/library/aa364935(v=vs.85).aspx
val (disk, spc, bps, fc, tc) = ("C:\\",
new IntByReference, // Sectors per cluster
new IntByReference, // Bytes per sector
new IntByReference, // Free clusters
new IntByReference) // Total clusters
val ok = GetDiskFreeSpaceA(disk, spc, bps, fc, tc) // status
println(f"'$disk%s' ($ok%s): sectors/cluster: ${spc.getValue}%d, bytes/sector: ${bps.getValue}%d, " +
f" free-clusters: ${fc.getValue}%d, total/clusters: ${tc.getValue}%d%n")
}}