try {
final CLibrary lib = getCLibrary();
return new HardLinkStrategy() {
public void hardlink(File source, File target) throws IOException {
int rc = lib.link(source.getCanonicalPath(), target.getCanonicalPath());
if( rc != 0 ){
throw new IOException("Hard link failed with result code="+rc);
}
}
};