<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>C on Blog GoHugo de Fredô : Linux, Proxmox, IA, Trail, Course, Randonnée, Gravel, Ski de Randonnée</title>
    <link>https://move.cyber-neurones.org/tags/c/</link>
    <description>Recent content in C on Blog GoHugo de Fredô : Linux, Proxmox, IA, Trail, Course, Randonnée, Gravel, Ski de Randonnée</description>
    <generator>Hugo</generator>
    <language>fr</language>
    <lastBuildDate>Tue, 30 Aug 2022 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://move.cyber-neurones.org/tags/c/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Quels sont les langages de programmation les plus verts ? (Dr. Milan Milanović)</title>
      <link>https://move.cyber-neurones.org/post/2022/08/2022-08-30-quels-sont-les-langages-de-programmation-les-plus-verts-dr-milan-milanovic/</link>
      <pubDate>Tue, 30 Aug 2022 00:00:00 +0000</pubDate>
      <guid>https://move.cyber-neurones.org/post/2022/08/2022-08-30-quels-sont-les-langages-de-programmation-les-plus-verts-dr-milan-milanovic/</guid>
      <description>&lt;p&gt;𝗖 𝗶𝘀 𝘁𝗵𝗲 𝗺𝗼𝘀𝘁 𝗲𝗳𝗳𝗶𝗰𝗶𝗲𝗻𝘁 𝗽𝗿𝗼𝗴𝗿𝗮𝗺𝗺𝗶𝗻𝗴 𝗹𝗮𝗻𝗴𝘂𝗮𝗴𝗲, 𝘄𝗵𝗶𝗹𝗲 𝗣𝘆𝘁𝗵𝗼𝗻 𝗮𝗻𝗱 𝗣𝗲𝗿𝗹 𝗮𝗿𝗲 𝘁𝗵𝗲 𝗹𝗲𝗮𝘀𝘁 𝗲𝗻𝘃𝗶𝗿𝗼𝗻𝗺𝗲𝗻𝘁𝗮𝗹 𝗳𝗿𝗶𝗲𝗻𝗱𝗹𝘆 𝗽𝗿𝗼𝗴𝗿𝗮𝗺𝗺𝗶𝗻𝗴 𝗹𝗮𝗻𝗴𝘂𝗮𝗴𝗲&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;images/1661501478217.jpeg&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;Artcile complet : &lt;a href=&#34;https://medium.com/codex/what-are-the-greenest-programming-languages-e738774b1957&#34;&gt;https://medium.com/codex/what-are-the-greenest-programming-languages-e738774b1957&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Développement en C sous Linux : pthread et la fonction sleep().</title>
      <link>https://move.cyber-neurones.org/post/2018/10/2018-10-17-developpement-en-c-sous-linux-pthread-et-la-fonction-sleep/</link>
      <pubDate>Wed, 17 Oct 2018 00:00:00 +0000</pubDate>
      <guid>https://move.cyber-neurones.org/post/2018/10/2018-10-17-developpement-en-c-sous-linux-pthread-et-la-fonction-sleep/</guid>
      <description>&lt;p&gt;Un petit exemple vaut mieux que de grands discours, voici le &lt;strong&gt;source en C&lt;/strong&gt; :&lt;/p&gt;&#xA;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;#include &#xA;#include &#xA;#include &#xA;#include &amp;lt;sys/time.h&amp;gt;&#xA;#include &amp;lt;sys/types.h&amp;gt;&#xA;#include &#xA;static long debut = 0;&#xA;void* longue_pause(void* a){&#xA;        pid_t t = getpid();&#xA;        printf(&amp;#34;pid = %d\n&amp;#34;,(int)t);&#xA;        printf(&amp;#34;thread longue_pause %d debut : %ld\n&amp;#34;,(int)pthread_self(),time(0)-debut);&#xA;        sleep(10);&#xA;        printf(&amp;#34;thread longue_pause %d fin : %ld\n&amp;#34;,(int)pthread_self(),time(0)-debut);&#xA;}&#xA;void* petites_pauses(void* a){&#xA;&#x9;int i = 0;&#xA;        pid_t t = getpid();&#xA;        printf(&amp;#34;pid = %d\n&amp;#34;,t);&#xA;        printf(&amp;#34;thread petites_pauses %d debut : %ld \n&amp;#34;,(int)pthread_self(), time(0)-debut);&#xA;        for(; i &amp;lt; 10 ;++i){&#xA;                printf(&amp;#34;thread petites_pauses %d en cours : %ld \n&amp;#34;,(int)pthread_self(), time(0)-debut);&#xA;                sleep(1);&#xA;        }&#xA;}&#xA;int main(){&#xA;        pthread_t longue;&#xA;        pthread_t petit1;&#xA;        pthread_t petit2;&#xA;        debut = time(0);&#xA;        pthread_create(&amp;amp;longue,NULL,longue_pause,NULL);&#xA;        pthread_create(&amp;amp;petit1,NULL,petites_pauses,NULL);&#xA;        pthread_create(&amp;amp;petit2,NULL,petites_pauses,NULL);&#xA;&#x9;sleep(8);&#xA;&#x9;printf(&amp;#34;Debut join: %ld\n&amp;#34;,time(0)-debut);&#xA;        pthread_join(longue,NULL);&#xA;        printf(&amp;#34;fin long : %ld\n&amp;#34;,time(0)-debut); &#xA;        pthread_join(petit1,NULL);&#xA;&#x9;printf(&amp;#34;fin petit1 : %ld\n&amp;#34;,time(0)-debut);&#x9;&#xA;        pthread_join(petit2,NULL);&#xA;&#x9;printf(&amp;#34;fin petit2 : %ld\n&amp;#34;,time(0)-debut);&#xA;}&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Pour la compilation :&lt;/p&gt;</description>
    </item>
    <item>
      <title>MYSQL : Portage de vieux code en C ... misère.</title>
      <link>https://move.cyber-neurones.org/post/2018/10/2018-10-03-mysql-portage-de-vieux-code-en-c-misere/</link>
      <pubDate>Wed, 03 Oct 2018 00:00:00 +0000</pubDate>
      <guid>https://move.cyber-neurones.org/post/2018/10/2018-10-03-mysql-portage-de-vieux-code-en-c-misere/</guid>
      <description>&lt;p&gt;Quelle misère ce portage sur une &lt;strong&gt;Fédora 14&lt;/strong&gt; :&lt;/p&gt;&#xA;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# make&#xA;…&#xA;/usr/bin/ld: cannot find -lmysqlclient&#xA; &#xA;# ldconfig -v | grep &amp;#34;mysql&amp;#34;&#xA;/usr/lib/mysql:&#xA;        libmysqlclient.so.16 -&amp;gt; libmysqlclient.so.16.0.0&#xA;        libmysqlclient_r.so.16 -&amp;gt; libmysqlclient_r.so.16.0.0&#xA; &#xA;# rpm -qa | grep mysql&#xA;mysql-devel-5.1.58-1.fc14.i686&#xA;mysql-5.1.58-1.fc14.i686&#xA;mysql-libs-5.1.58-1.fc14.i686&#xA; &#xA;# ld -lmysqlclient --verbose&#xA;GNU ld version 2.20.51.0.7-5.fc14 20100318&#xA;  Supported emulations:&#xA;   elf_i386&#xA;   i386linux&#xA;   elf_x86_64&#xA;   elf_l1om&#xA;using internal linker script:&#xA;==================================================&#xA;/* Script for -z combreloc: combine and sort reloc sections */&#xA;OUTPUT_FORMAT(&amp;#34;elf32-i386&amp;#34;, &amp;#34;elf32-i386&amp;#34;,&#xA;              &amp;#34;elf32-i386&amp;#34;)&#xA;OUTPUT_ARCH(i386)&#xA;ENTRY(_start)&#xA;SEARCH_DIR(&amp;#34;/usr/i686-redhat-linux/lib&amp;#34;); SEARCH_DIR(&amp;#34;/usr/local/lib&amp;#34;); SEARCH_DIR(&amp;#34;/lib&amp;#34;); SEARCH_DIR(&amp;#34;/usr/lib&amp;#34;);&#xA;SECTIONS&#xA;{&#xA;  /* Read-only sections, merged into text segment: */&#xA;  PROVIDE (__executable_start = SEGMENT_START(&amp;#34;text-segment&amp;#34;, 0x08048000)); . = SEGMENT_START(&amp;#34;text-segment&amp;#34;, 0x08048000) + SIZEOF_HEADERS;&#xA;  .interp         : { *(.interp) }&#xA;  .note.gnu.build-id : { *(.note.gnu.build-id) }&#xA;  .hash           : { *(.hash) }&#xA;  .gnu.hash       : { *(.gnu.hash) }&#xA;  .dynsym         : { *(.dynsym) }&#xA;  .dynstr         : { *(.dynstr) }&#xA;  .gnu.version    : { *(.gnu.version) }&#xA;  .gnu.version_d  : { *(.gnu.version_d) }&#xA;  .gnu.version_r  : { *(.gnu.version_r) }&#xA;  .rel.dyn        :&#xA;    {&#xA;      *(.rel.init)&#xA;      *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)&#xA;      *(.rel.fini)&#xA;      *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)&#xA;      *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)&#xA;      *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)&#xA;      *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)&#xA;      *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)&#xA;      *(.rel.ctors)&#xA;      *(.rel.dtors)&#xA;      *(.rel.got)&#xA;      *(.rel.sharable_data .rel.sharable_data.* .rel.gnu.linkonce.shrd.*)&#xA;      *(.rel.sharable_bss .rel.sharable_bss.* .rel.gnu.linkonce.shrb.*)&#xA;      *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)&#xA;      *(.rel.ifunc)&#xA;    }&#xA;  .rel.plt        :&#xA;    {&#xA;      *(.rel.plt)&#xA;      PROVIDE_HIDDEN (__rel_iplt_start = .);&#xA;      *(.rel.iplt)&#xA;      PROVIDE_HIDDEN (__rel_iplt_end = .);&#xA;    }&#xA;  .init           :&#xA;  {&#xA;    KEEP (*(.init))&#xA;  } =0x90909090&#xA;  .plt            : { *(.plt) *(.iplt) }&#xA;  .text           :&#xA;  {&#xA;    *(.text.unlikely .text.*_unlikely)&#xA;    *(.text .stub .text.* .gnu.linkonce.t.*)&#xA;    /* .gnu.warning sections are handled specially by elf32.em.  */&#xA;    *(.gnu.warning)&#xA;  } =0x90909090&#xA;  .fini           :&#xA;  {&#xA;    KEEP (*(.fini))&#xA;  } =0x90909090&#xA;  PROVIDE (__etext = .);&#xA;  PROVIDE (_etext = .);&#xA;  PROVIDE (etext = .);&#xA;  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }&#xA;  .rodata1        : { *(.rodata1) }&#xA;  .eh_frame_hdr : { *(.eh_frame_hdr) }&#xA;  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }&#xA;  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }&#xA;  /* Adjust the address for the data segment.  We want to adjust up to&#xA;     the same address within the page on the next page up.  */&#xA;  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) &amp;amp; (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));&#xA;  /* Exception handling  */&#xA;  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }&#xA;  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }&#xA;  /* Thread Local Storage sections  */&#xA;  .tdata          : { *(.tdata .tdata.* .gnu.linkonce.td.*) }&#xA;  .tbss           : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }&#xA;  .preinit_array     :&#xA;  {&#xA;    PROVIDE_HIDDEN (__preinit_array_start = .);&#xA;    KEEP (*(.preinit_array))&#xA;    PROVIDE_HIDDEN (__preinit_array_end = .);&#xA;  }&#xA;  .init_array     :&#xA;  {&#xA;     PROVIDE_HIDDEN (__init_array_start = .);&#xA;     KEEP (*(SORT(.init_array.*)))&#xA;     KEEP (*(.init_array))&#xA;     PROVIDE_HIDDEN (__init_array_end = .);&#xA;  }&#xA;  .fini_array     :&#xA;  {&#xA;    PROVIDE_HIDDEN (__fini_array_start = .);&#xA;    KEEP (*(SORT(.fini_array.*)))&#xA;    KEEP (*(.fini_array))&#xA;    PROVIDE_HIDDEN (__fini_array_end = .);&#xA;  }&#xA;  .ctors          :&#xA;  {&#xA;    /* gcc uses crtbegin.o to find the start of&#xA;       the constructors, so we make sure it is&#xA;       first.  Because this is a wildcard, it&#xA;       doesn&amp;#39;t matter if the user does not&#xA;       actually link against crtbegin.o; the&#xA;       linker won&amp;#39;t look for a file to match a&#xA;       wildcard.  The wildcard also means that it&#xA;       doesn&amp;#39;t matter which directory crtbegin.o&#xA;       is in.  */&#xA;    KEEP (*crtbegin.o(.ctors))&#xA;    KEEP (*crtbegin?.o(.ctors))&#xA;    /* We don&amp;#39;t want to include the .ctor section from&#xA;       the crtend.o file until after the sorted ctors.&#xA;       The .ctor section from the crtend file contains the&#xA;       end of ctors marker and it must be last */&#xA;    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))&#xA;    KEEP (*(SORT(.ctors.*)))&#xA;    KEEP (*(.ctors))&#xA;  }&#xA;  .dtors          :&#xA;  {&#xA;    KEEP (*crtbegin.o(.dtors))&#xA;    KEEP (*crtbegin?.o(.dtors))&#xA;    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))&#xA;    KEEP (*(SORT(.dtors.*)))&#xA;    KEEP (*(.dtors))&#xA;  }&#xA;  .jcr            : { KEEP (*(.jcr)) }&#xA;  .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }&#xA;  .dynamic        : { *(.dynamic) }&#xA;  .got            : { *(.got) *(.igot) }&#xA;  . = DATA_SEGMENT_RELRO_END (12, .);&#xA;  .got.plt        : { *(.got.plt)  *(.igot.plt) }&#xA;  .data           :&#xA;  {&#xA;    *(.data .data.* .gnu.linkonce.d.*)&#xA;    SORT(CONSTRUCTORS)&#xA;  }&#xA;  .data1          : { *(.data1) }&#xA;  /* Sharable data sections.  */&#xA;  .sharable_data   : ALIGN(CONSTANT (MAXPAGESIZE))&#xA;  {&#xA;    PROVIDE_HIDDEN (__sharable_data_start = .);&#xA;    *(.sharable_data .sharable_data.* .gnu.linkonce.shrd.*)&#xA;    /* Align here to ensure that the sharable data section ends at the&#xA;       page boundary.  */&#xA;    . = ALIGN(. != 0 ? CONSTANT (MAXPAGESIZE) : 1);&#xA;    PROVIDE_HIDDEN (__sharable_data_end = .);&#xA;  }&#xA;  _edata = .; PROVIDE (edata = .);&#xA;  __bss_start = .;&#xA;  .bss            :&#xA;  {&#xA;   *(.dynbss)&#xA;   *(.bss .bss.* .gnu.linkonce.b.*)&#xA;   *(COMMON)&#xA;   /* Align here to ensure that the .bss section occupies space up to&#xA;      _end.  Align after .bss to ensure correct alignment even if the&#xA;      .bss section disappears because there are no input sections.&#xA;      FIXME: Why do we need it? When there is no .bss section, we don&amp;#39;t&#xA;      pad the .data section.  */&#xA;   . = ALIGN(. != 0 ? 32 / 8 : 1);&#xA;  }&#xA;  /* Sharable bss sections  */&#xA;  .sharable_bss   : ALIGN(CONSTANT (MAXPAGESIZE))&#xA;  {&#xA;    PROVIDE_HIDDEN (__sharable_bss_start = .);&#xA;    *(.dynsharablebss)&#xA;    *(.sharable_bss .sharable_bss.* .gnu.linkonce.shrb.*)&#xA;    *(SHARABLE_COMMON)&#xA;    /* Align here to ensure that the sharable bss section ends at the&#xA;       page boundary.  */&#xA;    . = ALIGN(. != 0 ? CONSTANT (MAXPAGESIZE) : 1);&#xA;    PROVIDE_HIDDEN (__sharable_bss_end = .);&#xA;  }&#xA;  . = ALIGN(32 / 8);&#xA;  . = ALIGN(32 / 8);&#xA;  _end = .; PROVIDE (end = .);&#xA;  . = DATA_SEGMENT_END (.);&#xA;  /* Stabs debugging sections.  */&#xA;  .stab          0 : { *(.stab) }&#xA;  .stabstr       0 : { *(.stabstr) }&#xA;  .stab.excl     0 : { *(.stab.excl) }&#xA;  .stab.exclstr  0 : { *(.stab.exclstr) }&#xA;  .stab.index    0 : { *(.stab.index) }&#xA;  .stab.indexstr 0 : { *(.stab.indexstr) }&#xA;  .comment       0 : { *(.comment) }&#xA;  /* DWARF debug sections.&#xA;     Symbols in the DWARF debugging sections are relative to the beginning&#xA;     of the section so we begin them at 0. */&#xA;  /* DWARF 1 */&#xA;  .debug          0 : { *(.debug) }&#xA;  .line           0 : { *(.line) }&#xA;  /* GNU DWARF 1 extensions */&#xA;  .debug_srcinfo  0 : { *(.debug_srcinfo) }&#xA;  .debug_sfnames  0 : { *(.debug_sfnames) }&#xA;  /* DWARF 1.1 and DWARF 2 */&#xA;  .debug_aranges  0 : { *(.debug_aranges) }&#xA;  .debug_pubnames 0 : { *(.debug_pubnames) }&#xA;  /* DWARF 2 */&#xA;  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }&#xA;  .debug_abbrev   0 : { *(.debug_abbrev) }&#xA;  .debug_line     0 : { *(.debug_line) }&#xA;  .debug_frame    0 : { *(.debug_frame) }&#xA;  .debug_str      0 : { *(.debug_str) }&#xA;  .debug_loc      0 : { *(.debug_loc) }&#xA;  .debug_macinfo  0 : { *(.debug_macinfo) }&#xA;  /* SGI/MIPS DWARF 2 extensions */&#xA;  .debug_weaknames 0 : { *(.debug_weaknames) }&#xA;  .debug_funcnames 0 : { *(.debug_funcnames) }&#xA;  .debug_typenames 0 : { *(.debug_typenames) }&#xA;  .debug_varnames  0 : { *(.debug_varnames) }&#xA;  /* DWARF 3 */&#xA;  .debug_pubtypes 0 : { *(.debug_pubtypes) }&#xA;  .debug_ranges   0 : { *(.debug_ranges) }&#xA;  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }&#xA;  /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }&#xA;}&#xA; &#xA; &#xA;==================================================&#xA;attempt to open /usr/i686-redhat-linux/lib/libmysqlclient.so failed&#xA;attempt to open /usr/i686-redhat-linux/lib/libmysqlclient.a failed&#xA;attempt to open /usr/local/lib/libmysqlclient.so failed&#xA;attempt to open /usr/local/lib/libmysqlclient.a failed&#xA;attempt to open /lib/libmysqlclient.so failed&#xA;attempt to open /lib/libmysqlclient.a failed&#xA;attempt to open /usr/lib/libmysqlclient.so failed&#xA;attempt to open /usr/lib/libmysqlclient.a failed&#xA; &#xA;# locate /libmysqlclient.so&#xA;/usr/lib/mysql/libmysqlclient.so&#xA;/usr/lib/mysql/libmysqlclient.so.16&#xA;/usr/lib/mysql/libmysqlclient.so.16.0.0&#xA; &#xA;# ln -s /usr/lib/mysql/libmysqlclient.so /lib/libmysqlclient.so&#xA; &#xA;# make&#xA;: undefined reference to `mysql_connect&amp;#39;&#xA; &lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Ensuite il a fallu changer les fonctions &lt;strong&gt;mysql_connect&lt;/strong&gt; par &lt;strong&gt;mysql_real_connect&lt;/strong&gt; :&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
