Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <v39v87$1n7bk$1@dont-email.me>
Deutsch   English   Français   Italiano  
<v39v87$1n7bk$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bart <bc@freeuk.com>
Newsgroups: comp.lang.c
Subject: Re: C23 thoughts and opinions
Date: Thu, 30 May 2024 14:34:00 +0100
Organization: A noiseless patient Spider
Lines: 42
Message-ID: <v39v87$1n7bk$1@dont-email.me>
References: <v2l828$18v7f$1@dont-email.me>
 <00297443-2fee-48d4-81a0-9ff6ae6481e4@gmail.com>
 <v2lji1$1bbcp$1@dont-email.me> <87msoh5uh6.fsf@nosuchdomain.example.com>
 <f08d2c9f-5c2e-495d-b0bd-3f71bd301432@gmail.com>
 <v2nbp4$1o9h6$1@dont-email.me> <v2ng4n$1p3o2$1@dont-email.me>
 <87y18047jk.fsf@nosuchdomain.example.com>
 <87msoe1xxo.fsf@nosuchdomain.example.com> <v2sh19$2rle2$2@dont-email.me>
 <87ikz11osy.fsf@nosuchdomain.example.com> <v2v59g$3cr0f$1@dont-email.me>
 <v30l15$3mcj6$1@dont-email.me> <v30lls$3mepf$1@dont-email.me>
 <v30sai$3rilf$1@dont-email.me> <v320am$1km5$1@dont-email.me>
 <v33ggr$e0ph$1@dont-email.me> <v34bne$i85p$1@dont-email.me>
 <v3758s$14hfp$1@raubtier-asyl.eternal-september.org>
 <v38of2$1gsj2$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 30 May 2024 15:34:00 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="8c5499e5d518415769692484ec9a1979";
	logging-data="1809780"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19RzNvQEURwkj6M8zQj/RTY"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:pdldldNeCpYwN/dw6B1Y05PlHxo=
In-Reply-To: <v38of2$1gsj2$1@dont-email.me>
Content-Language: en-GB
Bytes: 3081

On 30/05/2024 03:32, Lawrence D'Oliveiro wrote:
> On Wed, 29 May 2024 13:58:20 +0200, Bonita Montero wrote:
> 
>> I've got a small commandline-tool that makes a const'd char
>> -array from any binary file.
> 
> It seems to me it would be more efficient to use objcopy to turn that
> binary file directly into an object file with symbols accessible from C
> code defining its beginning and ending points. Then just link it into the
> executable.

None of my compilers, whether for C or anything else, generate object files.

However, suppose I wanted to link a file called 'logo.bmp' say, into my 
program, which consisted of a file called main.c.

What is the entire process using your suggestion? What do I put into 
main.c? Assume the data is represented by a char-array.


In my language, it would simply be this:

     []byte logobmp = binclude("logo.bmp")

Using my C extension, it might be this:

    uint8_t logobmp[] = strinclude("logo.bmp");

(I believe this will cope with embedded zeros, and the file size is 
obtainable with 'sizeof(logobmp)'.

With the new feature it might be this (I forget the exact syntax):

    uint8_t logobmp[] = {
       #embed "logo.bmp"
    };

Nothing else is needed; just compile as normal.

The point of the feature is avoid the palavar with 'objcopy', which is a 
utility with 100 different options, or messing with ones like xxd.