Hello guys

Hello guys,

Is it possible to wrap/bridge a define from an external lib? I want to access the value of HOST_NAME_MAX from in my Android project. I was able to access a function from libc:

function gethostname(name: PUTF8Char; len: NativeUInt): Int32; cdecl; external LibC name Prefix + 'gethostname';

However I don't know how to access/wrap/bridge the value of HOST_NAME_MAX define from . Once its value is platform-dependent I can't hardcode it in my Delphi code.

Thanks in advance :D

Comments

  1. HOST_NAME_MAX is just a constant that you have to define in your delphi code, no way arround it.
    If need it to be platform dependent, you have to have {$IFDEF ...} per platform.

    ReplyDelete
  2. Simply importing a C header file would be a cool feature, but judging from how "good" the tools available for automatic translation of C header files to Pascal are, we will never get it.

    ReplyDelete
  3. Android does not support sysconf(_SC_HOST_NAME_MAX) for detection of maximal host name lenght. HOST_NAME_MAX for Android is 255 always. Keep calm and hardcode it :)

    ReplyDelete

Post a Comment