Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Re: How to Link a Miscellaneous File

Reply
Thread Tools

Re: How to Link a Miscellaneous File

 
 
Robert L. Smith, Jr.
Guest
Posts: n/a
 
      04-10-2005

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!

http://www.velocityreviews.com/forums/(E-Mail Removed)-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 <(E-Mail Removed)> 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 <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
 
Walter Roberson
Guest
Posts: n/a
 
      04-10-2005
In article <t0b6e.37164$(E-Mail Removed)> ,
Robert L. Smith, Jr. <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
 
Mark McIntyre
Guest
Posts: n/a
 
      04-10-2005
On Sun, 10 Apr 2005 14:47:53 GMT, in comp.lang.c ,
http://www.velocityreviews.com/forums/(E-Mail Removed) (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 =----
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      04-11-2005
Mark McIntyre <(E-Mail Removed)> writes:
> On Sun, 10 Apr 2005 14:47:53 GMT, in comp.lang.c ,
> (E-Mail Removed) (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) (E-Mail Removed) <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.
 
Reply With Quote
 
Mark McIntyre
Guest
Posts: n/a
 
      04-11-2005
On Mon, 11 Apr 2005 03:06:33 GMT, in comp.lang.c , Keith Thompson
<(E-Mail Removed)> wrote:

>Mark McIntyre <(E-Mail Removed)> writes:
>> On Sun, 10 Apr 2005 14:47:53 GMT, in comp.lang.c ,
>> (E-Mail Removed) (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>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Miscellaneous issues with tex4ht, xml and xsl transformations Geico Caveman XML 0 10-02-2008 06:34 PM
Miscellaneous ASP.NET question on a mail form... Henry Stock ASP .Net 3 08-16-2008 02:40 PM
How to Link a Miscellaneous File Robert L. Smith, Jr. C Programming 3 04-09-2005 10:25 PM
RE: Miscellaneous personal prejudices (was: Dr. Dobb's Python-URL!-weekly Python news and links (Oct 4)) Robert Brewer Python 2 10-05-2004 07:14 PM



Advertisments