Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Creating an .Obj File

Creating an .Obj File

Scheduled Pinned Locked Moved C / C++ / MFC
c++data-structurestutorialquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bram van Kampen
    wrote on last edited by
    #1

    Hi, I have Binary Data to be included in a DLL. The Tool I have developed to generate this data, currently creates a BYTE array in a CPP File. This File is subsequently compiled into an .obj File as part of the project, and linked in the normal way with the linker. The next step forward would be to have the Tool produce an obj file in the first place. Anyone any ideas how to do this? Microsoft maintains that .obj files are standard COFF Files. I know from experience that this is not strictly the case. In any case there is very little documentation about the further details, such as identification of sections of the Obj File, etc. I would need to produce a File that meets the minimum MS Linking Spec. There is only One 'C' linkable variable, the name of the array. Has anyone any ideas? Regards :)

    Bram van Kampen

    M L F 3 Replies Last reply
    0
    • B Bram van Kampen

      Hi, I have Binary Data to be included in a DLL. The Tool I have developed to generate this data, currently creates a BYTE array in a CPP File. This File is subsequently compiled into an .obj File as part of the project, and linked in the normal way with the linker. The next step forward would be to have the Tool produce an obj file in the first place. Anyone any ideas how to do this? Microsoft maintains that .obj files are standard COFF Files. I know from experience that this is not strictly the case. In any case there is very little documentation about the further details, such as identification of sections of the Obj File, etc. I would need to produce a File that meets the minimum MS Linking Spec. There is only One 'C' linkable variable, the name of the array. Has anyone any ideas? Regards :)

      Bram van Kampen

      M Offline
      M Offline
      Mauro Leggieri
      wrote on last edited by
      #2

      Hi, Adding the file as a custom resource and then using FindResource set of api's to access it, does not fit your needs? Regards, Mauro.

      1 Reply Last reply
      0
      • B Bram van Kampen

        Hi, I have Binary Data to be included in a DLL. The Tool I have developed to generate this data, currently creates a BYTE array in a CPP File. This File is subsequently compiled into an .obj File as part of the project, and linked in the normal way with the linker. The next step forward would be to have the Tool produce an obj file in the first place. Anyone any ideas how to do this? Microsoft maintains that .obj files are standard COFF Files. I know from experience that this is not strictly the case. In any case there is very little documentation about the further details, such as identification of sections of the Obj File, etc. I would need to produce a File that meets the minimum MS Linking Spec. There is only One 'C' linkable variable, the name of the array. Has anyone any ideas? Regards :)

        Bram van Kampen

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        https://msdn.microsoft.com/en-us/library/24b2tcy0.aspx[^] might help you. Trying to create a .obj file for something as simple as a byte array seems a bit extreme, when you can use a resource.

        1 Reply Last reply
        0
        • B Bram van Kampen

          Hi, I have Binary Data to be included in a DLL. The Tool I have developed to generate this data, currently creates a BYTE array in a CPP File. This File is subsequently compiled into an .obj File as part of the project, and linked in the normal way with the linker. The next step forward would be to have the Tool produce an obj file in the first place. Anyone any ideas how to do this? Microsoft maintains that .obj files are standard COFF Files. I know from experience that this is not strictly the case. In any case there is very little documentation about the further details, such as identification of sections of the Obj File, etc. I would need to produce a File that meets the minimum MS Linking Spec. There is only One 'C' linkable variable, the name of the array. Has anyone any ideas? Regards :)

          Bram van Kampen

          F Offline
          F Offline
          Frankie C
          wrote on last edited by
          #4

          The format MS uses is standard indeeded, it is named PE (portable executable), and you can get whole documentation here[^]. It is made public to avoid penalties from antitrust because, if hided, it could be seen as an abuse. It is based on COFF, and its almost the same, apart from the interpretation of location offsets that are different. You can create a PE object header, include your data in an initialized data section and create a symbbol in relocation.. :laugh: But if only need to access that data in the DLL the really easy solution is, as they already told you, to create a resource and use it.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups