Recent

Author Topic: onguard wont compile (mac)  (Read 894 times)

Michael Collier

  • Sr. Member
  • ****
  • Posts: 318
onguard wont compile (mac)
« on: June 11, 2024, 10:26:43 pm »
Hi

I get compilation errors compiling onguard (from online package manager) on Mac, but compiles on linux & windows.

Has anyone used onguard with Mac?

Thanks,
Mike

Thaddy

  • Hero Member
  • *****
  • Posts: 15213
  • Censorship about opinions does not belong here.
Re: onguard wont compile (mac)
« Reply #1 on: June 12, 2024, 01:47:06 pm »
Can you show the exceptions?
I don't use OnGuard anymore, but I know the code quite well.
Of course the national anthem of the U.S.A. was written by Jimi Hendrix, didn't you know that?

Michael Collier

  • Sr. Member
  • ****
  • Posts: 318
Re: onguard wont compile (mac)
« Reply #2 on: June 12, 2024, 09:40:23 pm »
I think the problem relates to the use of {$IFDEF xxx}, the error is forward declaration is not solved.

In package tponguard.lpk (not sure about other packages e.g. tponguard_design etc.) unit ogutil

at line 236 (in the interface section) refers to (not)WINDOWS i.e. DARWIN will find this..
Code: Pascal  [Select][+][-]
  1. {$IFNDEF WINDOWS}
  2. function GetDiskSerialNumber(Drive : AnsiChar) : LongInt;
  3. function MyHashElf(const Buf;  BufSize : LongInt) : LongInt;
  4. {$ENDIF}  

at line 396 (implementation) refers to LINUX (so missing from DARWIN)
Code: Pascal  [Select][+][-]
  1. {$IFDEF LINUX}
  2. function GetDiskSerialNumber(Drive : AnsiChar) : LongInt;
  3.  

I tried a few hacks to see if it would compile using {$IFDEF DARWIN} on my MacOS machine and IIRC it managed to compile, but then reverted the code back (IIRC I then had problems compiling in LINUX which considering this was a hack, was no surprise).

I think I changed 3 {$IFDEF} statements to get it to compile under DARWIN.

Probably worth a shot fixing it (I didn't know enough about the code), I'm happy to test (LINUX, WINDOWS,DARWIN).

Thaddy

  • Hero Member
  • *****
  • Posts: 15213
  • Censorship about opinions does not belong here.
Re: onguard wont compile (mac)
« Reply #3 on: June 12, 2024, 10:01:12 pm »
Try to change it to Unix instead of Linux.
Of course the national anthem of the U.S.A. was written by Jimi Hendrix, didn't you know that?

Michael Collier

  • Sr. Member
  • ****
  • Posts: 318
Re: onguard wont compile (mac)
« Reply #4 on: June 12, 2024, 10:36:21 pm »
I changed LINUX to UNIX, I can see from MacOS editor that the code becomes 'visible'.

When I compile I get error that HiWord not found, likely because another {$IFDEF} statement needs changing.

I'll take a look later at the package as a whole and see what can be done, thanks..

Thaddy

  • Hero Member
  • *****
  • Posts: 15213
  • Censorship about opinions does not belong here.
Re: onguard wont compile (mac)
« Reply #5 on: June 13, 2024, 06:24:10 am »
You can replace hiword with simply hi (from system). That has overloads for most integer types. Make sure it is really a 32 bit value, though: hi(some integer) will return the high word of a 32 bit integer value.
See the manual:
https://www.freepascal.org/docs-html/rtl/system/hi.html
If there are a lot of occurances, you can define a macro;
{$macro on}{$define hiword := hi}{$endif}
Note that macro's are not global, they work on a per unit basis.

hiword is declared in the windows unit, which does not belong in mac code, ofcourse.

It basically shows that onguard is firmly Windows based...
or include this;
Code: Pascal  [Select][+][-]
  1. function hiword(const value:cardinal):word;ínline;
  2. begin
  3.   result := value shr 16;
  4. end;
« Last Edit: June 13, 2024, 06:41:55 am by Thaddy »
Of course the national anthem of the U.S.A. was written by Jimi Hendrix, didn't you know that?

 

TinyPortal © 2005-2018