Re: How to Link a Miscellaneous File

Discussion in 'C Programming' started by Robert L. Smith, Jr., Apr 10, 2005.

  1. Several people replied to my request for a method to
    include a random binary dictionary file in an executable.
    Thanks very much to you all!

    -cnrc.gc.ca (Walter Roberson) POSTED:
    >...
    >I suggest that you write a program that reads the
    >dictionary file and spits out C code that contains its
    >equivilent.
    >...


    and Keith Thompson <> POSTED:
    >...
    >You might write a separate program that reads the file (in
    >binary mode) and generates as output a C source file that
    >declares an array of unsigned char initialized to the
    >contents of the file...


    These suggestions caused a bit of reflection. Then

    Mark McIntyre <> POSTED:
    >...
    >You'd need to look at compiler-specific ways of attaching
    >a binary object to your app. Most modern compilers can do
    >this easily with say bitmaps, menus and resource data,
    >presumably one can tailor this to handle random BLOBs.
    >...


    Maybe _you_ can find compiler (or IDE) documentation for
    including "BLOBs" in link runs, but I can't! Few creators
    of IDEs have produced intelligible user's guides for their
    products.

    The first two suggestions led to this idea: how about a
    program to convert my binary file into a COFF object
    module? The COFF format is in
    http://www.delorie.com/djgpp/doc/coff/
    (verified against a Visual-C++ .obj file). That is how I
    shall proceed.

    Thanks again, gents!

    --Robert Smith
    rlsj at nc.rr.com
    Robert L. Smith, Jr., Apr 10, 2005
    #1
    1. Advertising

  2. In article <t0b6e.37164$>,
    Robert L. Smith, Jr. <> wrote:
    >The first two suggestions led to this idea: how about a
    >program to convert my binary file into a COFF object
    >module?


    If you follow the suggestion Keith and I made about converting
    the binary into a C program that uses the binary as an
    initializer, then that method will work no matter -what- the
    object file format is, rather than being restricted to COFF.

    Even different COFF-based installations use different section
    names for different purposes, so really what you are proposing
    is to make the transformation platform-dependant, and subject
    to breaking the next time the compiler is re-written.


    Compilers -do- change over time. For example, for SGI's IRIX,
    COFF was the format used for IRIX 3 and IRIX 4, but with IRIX 5
    they switched to ELF as being the new desired format but with
    COFF objects still supported for both compilation and execution.
    IRIX 6.0 and IRIX 6.1 were short-lived releases to transition
    to 64 bit computation so they continued to support COFF in those,
    but by the consolidation release IRIX 6.2, COFF was gone. Around
    the same time, they also started incorporating DWARF symbol tables
    embedded in their ELF objects, in order to provide the portability
    of DWARF-based debuggers. Then after IRIX 6.3 and 6.4 (which
    were hardware-specific for hardware with very different design),
    they switched compilers *completely*, but stuck with the same end output
    file format, but with radically different intermediate representations...
    --
    "[...] it's all part of one's right to be publicly stupid." -- Dave Smey
    Walter Roberson, Apr 10, 2005
    #2
    1. Advertising

  3. On Sun, 10 Apr 2005 14:47:53 GMT, in comp.lang.c ,
    (Robert L. Smith, Jr.) wrote:

    >
    >Maybe _you_ can find compiler (or IDE) documentation for
    >including "BLOBs" in link runs, but I can't!


    FWIW, a resource such as a bitmap, icon or cursor is a binary file.

    Or, if you prefer
    project, add to project, new, binary file.

    then replace said new file with your own.

    /using/ this binary data is left as an exercise for the reader !



    --
    Mark McIntyre
    CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
    CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

    ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
    ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
    Mark McIntyre, Apr 10, 2005
    #3
  4. Mark McIntyre <> writes:
    > On Sun, 10 Apr 2005 14:47:53 GMT, in comp.lang.c ,
    > (Robert L. Smith, Jr.) wrote:
    >>Maybe _you_ can find compiler (or IDE) documentation for
    >>including "BLOBs" in link runs, but I can't!

    >
    > FWIW, a resource such as a bitmap, icon or cursor is a binary file.
    >
    > Or, if you prefer
    > project, add to project, new, binary file.
    >
    > then replace said new file with your own.
    >
    > /using/ this binary data is left as an exercise for the reader !


    That sounds like it's specific to some GUI-based IDE.

    I do most or all of my development under Unix and Unix-like systems;
    I've never used a GUI-based IDE more than very briefly. In the
    environments I use, the closest thing to a "project" is a directory
    tree containing source files.

    I'm not saying there's anything wrong with GUI-based IDEs, just that
    it may be unwise to assume that everyone uses them (or even has access
    to them).

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    We must do something. This is something. Therefore, we must do this.
    Keith Thompson, Apr 11, 2005
    #4
  5. On Mon, 11 Apr 2005 03:06:33 GMT, in comp.lang.c , Keith Thompson
    <> wrote:

    >Mark McIntyre <> writes:
    >> On Sun, 10 Apr 2005 14:47:53 GMT, in comp.lang.c ,
    >> (Robert L. Smith, Jr.) wrote:
    >>>Maybe _you_ can find compiler (or IDE) documentation for
    >>>including "BLOBs" in link runs, but I can't!

    >>
    >> FWIW, a resource such as a bitmap, icon or cursor is a binary file.
    >>

    snippage

    >> /using/ this binary data is left as an exercise for the reader !

    >
    >That sounds like it's specific to some GUI-based IDE.


    The menu choice instructions were. The bit I left in above isn't.

    >I'm not saying there's anything wrong with GUI-based IDEs, just that
    >it may be unwise to assume that everyone uses them (or even has access
    >to them).


    I didn't.
    The challenge was to " find compiler (or IDE) documentation".
    I suspect my post meets that challenge... :)

    --
    Mark McIntyre
    CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
    CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>
    Mark McIntyre, Apr 11, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin Spencer

    Re: Link Link Link DANGER WILL ROBINSON!!!

    Kevin Spencer, May 17, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    818
    Kevin Spencer
    May 17, 2005
  2. Robert Brewer
    Replies:
    2
    Views:
    374
    Ville Vainio
    Oct 5, 2004
  3. Robert L. Smith, Jr.

    How to Link a Miscellaneous File

    Robert L. Smith, Jr., Apr 9, 2005, in forum: C Programming
    Replies:
    3
    Views:
    328
    Mark McIntyre
    Apr 9, 2005
  4. Henry Stock
    Replies:
    3
    Views:
    753
    Henry Stock
    Aug 16, 2008
  5. Geico Caveman
    Replies:
    0
    Views:
    527
    Geico Caveman
    Oct 2, 2008
Loading...

Share This Page