Results 1 to 4 of 4

Thread: I need to find a specific function, where to look?

  1. #1

    I need to find a specific function, where to look?

    I'm currently trying to find a function called mach_absolute_time, to use as replacement for gettickcount in MacOS.
    (I've been using Now() function, but seems to don't have enough precision).
    The problem is, I can not find this mach_absolute_time() function anywhere!
    And I also need mach_timebase_info, seems that both this functions are available for mac and iphone, and are used for high precision timing.

    I've downloaded FPC source from svn, searched through all files, and find two references to those functions, but just comments, not the actual function documentation.
    I also tried declaring the function as external, but it gives a linker error (and probably the calling stack should be cdecl or something else, I don't know)
    Function mach_absolute_time():Int64; External;

    Help?

  2. #2
    Due to this, try to define your function like this:
    Code:
    Function mach_absolute_time():Int64; cdecl; External 'libc';
    For my library I use Carbon function Microseconds, but seems I will move to BSD gettimeofday, because it similar to Linux one, or will try to use mach_absolute_time how described here

  3. #3
    Yes, adding the cdecl fixed it, thanks!
    I've also added the conversion to miliseconds, now with the extra precision, everything works exactly as in windows
    I just find it strange that the function could not be found anywhere in fpc units, not even in macosall.pp

  4. #4
    Quote Originally Posted by Relfos
    I just find it strange that the function could not be found anywhere in fpc units, not even in macosall.pp
    Unfortunately this is not strange... there is no libc unit for Linux/MacOS X/*BSD, where must be a lot of functions.

    Quote Originally Posted by Relfos
    Yes, adding the cdecl fixed it, thanks!
    Only cdecl? Although, maybe somewhere your application has been already linked to libc.
    Last edited by Andru; 16-02-2011 at 02:49 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •