Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Downloads
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Calendar
  - Forums
  - IRC
  - Community Discord
  - Wiki
  - GitHub
  - Issues
  - Get involved
  - Contributors
  - Foundation
  - Security Team
  - Donate
  - Sponsors
- Resources
  - Tour
  - Books
  - Tutorials
  - Tools
  - Editors
  - IDEs
  - run.dlang.io
  - Visual D
  - Acknowledgments
  - D Style
  - Glossary
  - Sitemap

Search
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

# core.sys.darwin.mach.getsect

D header file for mach-o/getsect.h.
License:
Boost License 1.0.
Authors:
Jacob Carlborg
Version:
Initial created: Mar 16, 2010

Source core/sys/darwin/mach/getsect.d

struct `MachHeader`;
  In reality this will be core.sys.darwin.mach.loader.mach_header on 32-bit platforms and core.sys.darwin.mach.loader.mach_header_64 64-bit platforms.
struct `SegmentCommand`;
  In reality this will be core.sys.darwin.mach.loader.segment_command on 32-bit platforms and core.sys.darwin.mach.loader.segment_command_64 64-bit platforms.
struct `Section`;
  In reality this will be core.sys.darwin.mach.loader.section on 32-bit platforms and core.sys.darwin.mach.loader.section_64 64-bit platforms.
nothrow @nogc char* `getsectdata`(scope const char* `segname`, scope const char* `sectname`, c_ulong* `size`);
  Returns the section data of section with the given section name.
  Returns the section data of the given section in the given segment in the mach executable it is linked into.

      void main()
      {
           import core.sys.darwin.mach.getsect;
           int size;
           assert(getsectdata("__TEXT", "__text", &size));
           assert(size > 0);
      }

  Parameters:

  char* `segname` | the name of the segment
  char* `sectname` | the name of the section
  c_ulong* `size` | this will be set to the size of the section or 0 if the section doesn't exist

  Returns:
  a pointer to the section data or null if it doesn't exist
nothrow @nogc char* `getsectdatafromFramework`(scope const char* `FrameworkName`, scope const char* `segname`, scope const char* `sectname`, c_ulong* `size`);
  Returns the section data of section with the given section name.
  Returns the section data of the given section in the given segment in the given framework.

      void main()
      {
           import core.sys.darwin.mach.getsect;
           int size;
           assert(getsectdatafromFramework("Foundation", "__TEXT", "__text", &size));
           assert(size > 0);
      }

  Parameters:

  char* `FrameworkName` | the name of the framework to get the section data from
  char* `segname` | the name of the segment
  char* `sectname` | the name of the section
  c_ulong* `size` | this will be set to the size of the section or 0 if the section doesn't exist

  Returns:
  a pointer to the section data or null if it doesn't exist
nothrow @nogc c_ulong `get_end`();
nothrow @nogc c_ulong `get_etext`();
nothrow @nogc c_ulong `get_edata`();
nothrow @nogc const(Section)* `getsectbyname`(scope const char* `segname`, scope const char* `sectname`);
  Returns the section with the given section name.
  Returns the section structure of the given section in the given segment in the mach executable it is linked into.

      void main()
      {
           import core.sys.darwin.mach.getsect;
           assert(getsectbyname("__TEXT", "__text"));
      }

  Parameters:

  char* `segname` | the name of the segment
  char* `sectname` | the name of the section

  Returns:
  a pointer to the section structure or null if it doesn't exist
nothrow @nogc ubyte* `getsectiondata`(scope const MachHeader* `mhp`, scope const char* `segname`, scope const char* `sectname`, c_ulong* `size`);
  Returns the section data of section with the given section name.
  Returns the section data of the given section in the given segment in the image pointed to by the given mach header.

      void main()
      {
           import core.sys.darwin.mach.getsect;
           import core.sys.darwin.crt_externs;

           auto mph = _NSGetMachExecuteHeader();
           int size;
           assert(getsectdata(mph, "__TEXT", "__text", &size));
           assert(size > 0);
      }

  Parameters:

  MachHeader* `mhp` | the mach header to get the section data from
  char* `segname` | the name of the segment
  char* `sectname` | the name of the section
  c_ulong* `size` | this will be set to the size of the section or 0 if the section doesn't exist

  Returns:
  a pointer to the section data or null if it doesn't exist
nothrow @nogc const(SegmentCommand)* `getsegbyname`(scope const char* `segname`);
  Returns the segment with the given segment name.
  Returns the segment structure of the given segment in the mach executable it is linked into.

      void main()
      {
           import core.sys.darwin.mach.getsect;
           assert(getsegbyname("__TEXT"));
      }

  Parameters:

  char* `segname` | the name of the segment

  Returns:
  a pointer to the section structure or null if it doesn't exist
nothrow @nogc ubyte* `getsegmentdata`(scope const MachHeader* `mhp`, scope const char* `segname`, c_ulong* `size`);
  Returns the segment data of segment with the given segment name.
  Returns the segment data of the given segment in the image pointed to by the given mach header.

      void main()
      {
           import core.sys.darwin.mach.getsect;
           import core.sys.darwin.crt_externs;

           auto mph = _NSGetMachExecuteHeader();
           int size;
           assert(getsegmentdata(mph, "__TEXT", &size));
           assert(size > 0);
      }

  Parameters:

  MachHeader* `mhp` | the mach header to get the section data from
  char* `segname` | the name of the segment
  c_ulong* `size` | this will be set to the size of the section or 0 if the section doesn't exist

  Returns:
  a pointer to the section data or null if it doesn't exist
nothrow @nogc ubyte* `getsectdatafromheader`(scope const mach_header* `mhp`, scope const char* `segname`, scope const char* `sectname`, c_ulong* `size`);
nothrow @nogc ubyte* `getsectdatafromheader_64`(scope const mach_header_64* `mhp`, scope const char* `segname`, scope const char* `sectname`, c_ulong* `size`);
  Returns the section data of section with the given section name.
  Returns the section data of the given section in the given segment in the image pointed to by the given mach header.

      void main()
      {
           import core.sys.darwin.mach.getsect;
           import core.sys.darwin.crt_externs;

           auto mph = _NSGetMachExecuteHeader();
           int size;
           assert(getsectdatafromheader(mph, "__TEXT", "__text", &size));
           assert(size > 0);
      }

  Parameters:

  mach_header* `mhp` | the mach header to get the section data from
  char* `segname` | the name of the segment
  char* `sectname` | the name of the section
  c_ulong* `size` | this will be set to the size of the section or 0 if the section doesn't exist

  Returns:
  a pointer to the section data or null if it doesn't exist
nothrow @nogc const(section)* `getsectbynamefromheader`(scope const mach_header* `mhp`, scope const char* `segname`, scope const char* `sectname`);
nothrow @nogc const(section_64)* `getsectbynamefromheader_64`(scope const mach_header_64* `mhp`, scope const char* `segname`, scope const char* `sectname`);
  Returns the section with the given section name.
  Returns the section structure of the given section in the given segment in image pointed to by the given mach header.

      void main()
      {
           import core.sys.darwin.mach.getsect;
           import core.sys.darwin.crt_externs;

           auto mph = _NSGetMachExecuteHeader();
           assert(getsectbynamefromheader(mph, "__TEXT", "__text"));
      }

  Parameters:

  mach_header* `mhp` | the mach header to get the section from
  char* `segname` | the name of the segment
  char* `sectname` | the name of the section

  Returns:
  a pointer to the section structure or null if it doesn't exist
nothrow @nogc const(`section`)* `getsectbynamefromheaderwithswap`(scope const mach_header* `mhp`, scope const char* `segname`, scope const char* `section`, int `fSwap`);
nothrow @nogc const(`section`)* `getsectbynamefromheaderwithswap_64`(scope const mach_header_64* `mhp`, scope const char* `segname`, scope const char* `section`, int `fSwap`);
  Returns the section with the given section name.
  Returns the section structure of the given section in the given segment in image pointed to by the given mach header.
  Parameters:

  mach_header* `mhp` | the mach header to get the section from
  char* `segname` | the name of the segment
  char* `section` | the name of the section
  int `fSwap` | ?

  Returns:
  a pointer to the section structure or null if it doesn't exist

Copyright © 1999-2020 by the D Language Foundation | Page generated by Ddoc on Thu Jun 11 11:22:46 2020