System identification or CPU serial lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- gamagros · 2011-03-30 05:58 I'm new in the forum and a newbie with Lazarus. I have to migrate a FP+Lazarus application from Windows to Mac and need a method to identificate the system the app has been installed in. The windows version uses some properties of the system accessing to windows specific methods, but I don't know about similar methods to get any system parameter I can use to identificate and differentiate instances of the installed app. Any help will be welcome. G. ---------------------------------------------------------------------- Blaazen · 2011-03-30 09:01 Welcome. There are compiler directives like: Code: [Select]{$ifdef window ... your Windows code ... {$endif}} {$ifdef unix ... your Linux & Mac code ... {$endif}} {$ifdef darwin ... your Mac code ... {$endif}} where you can specify that different code will be compiled for different platforms. Some code works for all platforms: Code: [Select]screen.width; See: http://wiki.lazarus.freepascal.org/Multiplatform_Programming_Guide ---------------------------------------------------------------------- gamagros · 2011-03-30 09:13 Quote from: Blaazen on March 30, 2011, 11:01:17 amThere are compiler directives like: Thank you very much. I know I have directives and tools to know the kinda system the app is being compiled for or running on. Nevertheless, I don't want to know that but the identification of the machine. I want to tell a installation from  another. So, the serial number of the current computer where app is running or something similar would be perfect if I can get that info. G. ---------------------------------------------------------------------- rajivsoft · 2011-04-05 08:35 with a bot of research i'v found this command that may help you: Code: [Select]sysctlwith -A you see all variables (they are MUCH, with -X MUCH MORE XD ), i'v found some interessant: Code: [Select]hw.cpufamily machdep.cpu.feature_bits machdep.cpu.extfeature_bits machdep.cpu.signatureyou can combine them toghether and then make a hash btw to get a single value use Code: [Select]sysctl hw.cpufamilylook here to see how to get them http ://www.lazarus.freepascal.org/index.php/topic,12697.msg65555.html#msg6 5555 ---------------------------------------------------------------------- ik · 2011-04-05 09:52 On Linux you can parse /proc/cpuinfo for all of the details you require per CPU, so if you have quad core you will see there 4 or 8 CPU. if there are 8, then 4 of them are hyperthread CPU (Virtual CPU by Intel). You can see there all of the details each CPU can provide, including flags of what they can do (For example does they support 64 bit/long mode even though you are on 32 bit and many more). ---------------------------------------------------------------------- rajivsoft · 2011-04-05 11:00 Quote from: ik on April 05, 2011, 11:52:42 amOn Linux you can parse /proc/cpuinfo for all of the details you require per CPU, so if you have quad core you will see there 4 or 8 CPU. if there are 8, then 4 of them are hyperthread CPU (Virtual CPU by Intel). You can see there all of the details each CPU can provide, including flags of what they can do (For example does they support 64 bit/long mode even though you are on 32 bit and many more). on Mac i havn't found any /proc/cpuinfo only sysctl hw for general hardware info and sysctl machdep.cpu for more cpu related info ---------------------------------------------------------------------- marcov · 2011-04-05 14:06 Note that Darwin and FreeBSD also have a unit sysctl to do this programmatically (without external program calls)