Browse Source

Initial fix for PascalCoinMiner for Linux compilation

maciej-izak 7 years ago
parent
commit
1e6fd06ba5
3 changed files with 19 additions and 25 deletions
  1. 8 6
      PasOpenCL/DelphiCL.pas
  2. 0 8
      PascalCoinMiner.lpi
  3. 11 11
      PascalCoinMiner.pp

+ 8 - 6
PasOpenCL/DelphiCL.pas

@@ -26,7 +26,9 @@ interface
 uses
 uses
   CL,
   CL,
   CL_GL,
   CL_GL,
+  {$IFDEF WINDOWS}
   Windows,
   Windows,
+  {$ENDIF}
   SysUtils,
   SysUtils,
   dglOpenGL,
   dglOpenGL,
   CL_Platform;
   CL_Platform;
@@ -2182,10 +2184,10 @@ end;
 
 
 constructor TDCLContext.CreateGL(Device_id: PCL_device_id);
 constructor TDCLContext.CreateGL(Device_id: PCL_device_id);
 var
 var
-  props: array [0..4] of TCL_uint;
+  props: array [0..4] of Pointer;
 begin
 begin
   inherited Create();
   inherited Create();
-  props[0] := CL_GL_CONTEXT_KHR;
+  props[0] := Pointer(CL_GL_CONTEXT_KHR);
 
 
   //MacOsX not yet (Andoid hm....)
   //MacOsX not yet (Andoid hm....)
   //MacOSX, Linux, Windows: http://www.dyn-lab.com/articles/cl-gl.html
   //MacOSX, Linux, Windows: http://www.dyn-lab.com/articles/cl-gl.html
@@ -2196,8 +2198,8 @@ begin
   {$ENDIF}
   {$ENDIF}
   {$IFDEF LINUX}
   {$IFDEF LINUX}
     props[1] := glXGetCurrentContext();
     props[1] := glXGetCurrentContext();
-    props[2] := CL_GLX_DISPLAY_KHR;
-    props[3] := glXGetCurrentDisplay();
+    props[2] := Pointer(CL_GLX_DISPLAY_KHR);
+    props[3] := Pointer(glXGetCurrentDisplayEXT());
   {$ENDIF}
   {$ENDIF}
   props[4] := 0;
   props[4] := 0;
 
 
@@ -2572,7 +2574,7 @@ var
   EndTime: TCL_ulong;
   EndTime: TCL_ulong;
 {$ENDIF}
 {$ENDIF}
 begin
 begin
-  ZeroMemory(@origin, SizeOf(origin));
+  FillChar(origin, SizeOf(origin), #0);
   region[0] := Image.Width;
   region[0] := Image.Width;
   region[1] := Image.Height;
   region[1] := Image.Height;
   region[2] := 1;// Image 2D
   region[2] := 1;// Image 2D
@@ -2611,7 +2613,7 @@ var
   EndTime: TCL_ulong;
   EndTime: TCL_ulong;
 {$ENDIF}
 {$ENDIF}
 begin
 begin
-  ZeroMemory(@origin, SizeOf(origin));
+  FillChar(origin, SizeOf(origin), #0);
   region[0] := Width;
   region[0] := Width;
   region[1] := Height;
   region[1] := Height;
   region[2] := 1;// Image 2D
   region[2] := 1;// Image 2D

+ 0 - 8
PascalCoinMiner.lpi

@@ -17,9 +17,6 @@
     <i18n>
     <i18n>
       <EnableI18N LFM="False"/>
       <EnableI18N LFM="False"/>
     </i18n>
     </i18n>
-    <VersionInfo>
-      <StringTable ProductVersion=""/>
-    </VersionInfo>
     <BuildModes Count="1">
     <BuildModes Count="1">
       <Item1 Name="Default" Default="True"/>
       <Item1 Name="Default" Default="True"/>
     </BuildModes>
     </BuildModes>
@@ -60,11 +57,6 @@
         <OptimizationLevel Value="3"/>
         <OptimizationLevel Value="3"/>
       </Optimizations>
       </Optimizations>
     </CodeGeneration>
     </CodeGeneration>
-    <Linking>
-      <Debugging>
-        <GenerateDebugInfo Value="False"/>
-      </Debugging>
-    </Linking>
   </CompilerOptions>
   </CompilerOptions>
   <Debugging>
   <Debugging>
     <Exceptions Count="3">
     <Exceptions Count="3">

+ 11 - 11
PascalCoinMiner.pp

@@ -1,6 +1,6 @@
 program PascalCoinMiner;
 program PascalCoinMiner;
 
 
-{$mode objfpc}{$H+}
+{$mode delphi}{$H+}
 {$DEFINE UseCThreads}
 {$DEFINE UseCThreads}
 {$I ./Units/PascalCoin/config.inc}
 {$I ./Units/PascalCoin/config.inc}
 
 
@@ -160,7 +160,7 @@ begin
       txt := copy(txt,1,FWindow32X2-FWindow32X1+1);
       txt := copy(txt,1,FWindow32X2-FWindow32X1+1);
     end;
     end;
     if (nline<=(FWindow32Y2-FWindow32Y1)) then begin
     if (nline<=(FWindow32Y2-FWindow32Y1)) then begin
-      GotoXY32(FWindow32X1,nline);
+      GotoXY(FWindow32X1,nline);
       write(txt);
       write(txt);
     end;
     end;
   finally
   finally
@@ -180,7 +180,7 @@ begin
     // TODO - test logtype is properly casted/stored/retrieved/accessed.
     // TODO - test logtype is properly casted/stored/retrieved/accessed.
     // Confirm casting doesn't lose bits in 32/64 bit archs
     // Confirm casting doesn't lose bits in 32/64 bit archs
     // OLD: FLastLogs.AddObject(msg,TObject(PtrInt(logtype)));
     // OLD: FLastLogs.AddObject(msg,TObject(PtrInt(logtype)));
-    FLastLogs.AddObject(msg,TObject(Int(QWord(logtype))));
+    FLastLogs.AddObject(msg,Pointer(logtype));
     i := FLastLogs.Count-CT_MaxLogs;
     i := FLastLogs.Count-CT_MaxLogs;
     if (i<0) then i:=0;
     if (i<0) then i:=0;
     nline := CT_Line_Logs+FDeviceThreads.Count;
     nline := CT_Line_Logs+FDeviceThreads.Count;
@@ -222,9 +222,9 @@ var
         exit;
         exit;
       end;
       end;
       devt:= TCPUDeviceThread.Create(FPoolMinerThread,CT_TMinerValuesForWork_NULL);
       devt:= TCPUDeviceThread.Create(FPoolMinerThread,CT_TMinerValuesForWork_NULL);
-      devt.OnStateChanged:=@OnDeviceStateChanged;
-      devt.OnMinerValuesChanged:=@OnMinerValuesChanged;
-      devt.OnFoundNOnce:=@OnFoundNOnce;
+      devt.OnStateChanged:=OnDeviceStateChanged;
+      devt.OnMinerValuesChanged:=OnMinerValuesChanged;
+      devt.OnFoundNOnce:=OnFoundNOnce;
       TCPUDeviceThread(devt).CPUs:=c;
       TCPUDeviceThread(devt).CPUs:=c;
       devt.Paused:=true;
       devt.Paused:=true;
       FDeviceThreads.Add(devt);
       FDeviceThreads.Add(devt);
@@ -252,9 +252,9 @@ var
           end;
           end;
           //
           //
           devt := TGPUDeviceThread.Create(FPoolMinerThread,CT_TMinerValuesForWork_NULL);
           devt := TGPUDeviceThread.Create(FPoolMinerThread,CT_TMinerValuesForWork_NULL);
-          devt.OnStateChanged:=@OnDeviceStateChanged;
-          devt.OnMinerValuesChanged:=@OnMinerValuesChanged;
-          devt.OnFoundNOnce:=@OnFoundNOnce;
+          devt.OnStateChanged:=OnDeviceStateChanged;
+          devt.OnMinerValuesChanged:=OnMinerValuesChanged;
+          devt.OnFoundNOnce:=OnFoundNOnce;
           TGPUDeviceThread(devt).Platform:=p;
           TGPUDeviceThread(devt).Platform:=p;
           TGPUDeviceThread(devt).Device:=d;
           TGPUDeviceThread(devt).Device:=d;
           TGPUDeviceThread(devt).ProgramFileName:=ExtractFileDir(ExeName)+PathDelim+CT_OpenCL_FileName;
           TGPUDeviceThread(devt).ProgramFileName:=ExtractFileDir(ExeName)+PathDelim+CT_OpenCL_FileName;
@@ -362,7 +362,7 @@ var
         FPoolMinerThread.MinerAddName:=minerName;
         FPoolMinerThread.MinerAddName:=minerName;
         WriteLine(CT_Line_MinerValues-1,'MINER VALUES: (My miner name="'+minerName+'")');
         WriteLine(CT_Line_MinerValues-1,'MINER VALUES: (My miner name="'+minerName+'")');
 
 
-        FPoolMinerThread.OnConnectionStateChanged:=@OnConnectionStateChanged;
+        FPoolMinerThread.OnConnectionStateChanged:=OnConnectionStateChanged;
         OnConnectionStateChanged(FPoolMinerThread);
         OnConnectionStateChanged(FPoolMinerThread);
 
 
         If (FDeviceThreads.Count)=1 then begin
         If (FDeviceThreads.Count)=1 then begin
@@ -373,7 +373,7 @@ var
         end;
         end;
         Flog := TLog.Create(Nil);
         Flog := TLog.Create(Nil);
         try
         try
-          Flog.OnInThreadNewLog:=@OnInThreadNewLog;
+          Flog.OnInThreadNewLog:=OnInThreadNewLog;
           DoWaitAndLog;
           DoWaitAndLog;
         finally
         finally
           FLog.free;
           FLog.free;