loadflint[] := 
 With[{file1 = 
    FileNameJoin[{$UserBaseDirectory, "mylib", "flintsolver.dll"}], 
   file2 = FileNameJoin[{$UserBaseDirectory, "mylib", 
      "libwinpthread-1.dll"}]}, 
  If[! FileExistsQ[file1], 
   With[{dir = FileNameJoin[{$UserBaseDirectory, "mylib"}]}, 
    If[! DirectoryQ[dir], CreateDirectory[dir]];]; 
   URLDownload["https://files.doubilee.com/lib/win/flintsolver.dll", 
    file1];];
  If[! FileExistsQ[file2], 
   With[{dir = FileNameJoin[{$UserBaseDirectory, "mylib"}]}, 
    If[! DirectoryQ[dir], CreateDirectory[dir]];]; 
   URLDownload[
    "https://files.doubilee.com/lib/win/libwinpthread-1.dll", file2];];
  LibraryLoad[file2];
  preflintrref = 
   LibraryFunctionLoad[file1, 
    "wll_flint_rref_safe", {{Integer, 1}, {Integer, 2}, UTF8String, 
     UTF8String}, UTF8String];
  ]
unloadflint[] := 
 With[{file2 = 
    FileNameJoin[{$UserBaseDirectory, "mylib", 
      "libwinpthread-1.dll"}]}, LibraryUnload[file2]; 
  LibraryFunctionUnload /@ {preflintrref};]
loadflint[];

Flintrref[mat_]:=With[{dims=Dimensions[mat],posmat=mat["ExplicitPositions"],strs={StringTake[ToString[Numerator@#,InputForm],{2,-2}],StringTake[ToString[Denominator@#,InputForm],{2,-2}]}&@mat["ExplicitValues"]},With[{nums=First[strs],dens=Last[strs]},With[{result=preflintrref[dims,posmat,nums,dens]},SparseArray[ToExpression[result],dims]]]]
FlintSolver[eqs_,vars_]:=With[{mat=Last@CoefficientArrays[eqs,vars]},With[{dims=Dimensions[mat],posmat=mat["ExplicitPositions"],strs={StringTake[ToString[Numerator@#,InputForm],{2,-2}],StringTake[ToString[Denominator@#,InputForm],{2,-2}]}&@mat["ExplicitValues"]},With[{nums=First[strs],dens=Last[strs]},With[{result=ToExpression@preflintrref[dims,posmat,nums,dens]},Function[row,vars[[row[[1,1,2]]]]->(-(Last/@#)) . (vars[[#[[1,2]]]]&/@#)&@(Rest[row])]/@GatherBy[result,#[[1,1]]&]]]]]
