Results 1 to 5 of 5

Thread: how to convert this struct to delphi?

  1. #1

    how to convert this struct to delphi?

    Languages: c++/delphi

    During the conversion of the efx extension for openal i come accros a struct that for the moment confuses me.

    What is this? Is it a record, or is it a function? Or is it a record to an pointer?

    Code:
    typedef struct _EAXOBSTRUCTIONPROPERTIES
    {
        long          lObstruction;
        float         flObstructionLFRatio;
    } EAXOBSTRUCTIONPROPERTIES, *LPEAXOBSTRUCTIONPROPERTIES;
    And most importanty how do i write this in delphi?

    This i how i think it should be done, but i am NOT sure.
    Code:
    _EAXOBSTRUCTIONPROPERTIES = record
      lObstruction: int64;
      flObstruction: single;
    end;
    LPEAXOBSTRUCTIONPROPERTIES = ^_EAXOBSTRUCTIONPROPERTIES;
    http://3das.noeska.com - create adventure games without programming

  2. #2

    how to convert this struct to delphi?

    Yes, I think your version is correct, but I'd do it like this:
    Code:
    _EAXOBSTRUCTIONPROPERTIES = record
      lObstruction: int64;
      flObstruction: single;
    end;
    EAXOBSTRUCTIONPROPERTIES = _EAXOBSTRUCTIONPROPERTIES;
    LPEAXOBSTRUCTIONPROPERTIES = ^EAXOBSTRUCTIONPROPERTIES;
    Similar to what you can find in Windows.pas.

  3. #3

    how to convert this struct to delphi?

    C long = Delphi integer not int64
    From brazil (:

    Pascal pownz!

  4. #4

    how to convert this struct to delphi?

    You are right, but I've seen a lot of translations, where long has been treated like Delphi's Int64.

  5. #5

    how to convert this struct to delphi?

    It depends on the processor running the code. Normally long is just 32bit. long long on the other hand is 64.

    Also, Don't forget to pack the record
    Peregrinus, expectavi pedes meos in cymbalis
    Nullus norvegicorum sole urinat

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
  •