<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>S32 Design StudioのトピックRe: Where is _libc_init_array() defined?</title>
    <link>https://community.nxp.com/t5/S32-Design-Studio/Where-is-libc-init-array-defined/m-p/1956507#M12658</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;_libc_init_array is part of STD C library (for example libc_nano.a). If you are using C++ you don't need link STD C Library and call _libc_init_array.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 18 Sep 2024 09:34:12 GMT</pubDate>
    <dc:creator>jiri_kral</dc:creator>
    <dc:date>2024-09-18T09:34:12Z</dc:date>
    <item>
      <title>Where is _libc_init_array() defined?</title>
      <link>https://community.nxp.com/t5/S32-Design-Studio/Where-is-libc-init-array-defined/m-p/1954260#M12657</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working on the S32K344 microcontroller and I need to execute c++ code. After finding out c++ is not officially suported with and SDK project I tried to implement some of the workarounds explained in nxp community pages.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In short, the steps are: create a C project with SDK, add C++ nature, rename main.c to main.cpp, change standard linker file to the linker file created in the project in project settings (see image).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Screenshot 2024-09-13 134701.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/299057i2AD1C0A8374827FD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2024-09-13 134701.png" alt="Screenshot 2024-09-13 134701.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After this steps I am able to build a project with main.cpp, however the objects declared outside of main are not executed or initialized.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;One solution i found to this problem is to include&amp;nbsp; __libc_init_array() at the beginning of main(). The problem now is that this function is not found. How can i add the library to solve this dependence? Is there any other solution to initialize objects outside of main in c++? Console output:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Building file: ../RTD/src/Clock_Ip_ExtOsc.c&lt;BR /&gt;Invoking: Standard S32DS C Compiler&lt;BR /&gt;arm-none-eabi-gcc "@RTD/src/Adc_Sar_Ip.args" -MMD -MP -MF"RTD/src/Clock_Ip_ExtOsc.d" -MT"RTD/src/Clock_Ip_ExtOsc.o" -o "RTD/src/Clock_Ip_ExtOsc.o" "../RTD/src/Clock_Ip_ExtOsc.c"&lt;BR /&gt;../src/main.cpp: In function 'int main()':&lt;BR /&gt;../src/main.cpp:59:2: error: '__libc_init_array' was not declared in this scope&lt;BR /&gt;59 | __libc_init_array();&lt;BR /&gt;| ^~~~~~~~~~~~~~~~~&lt;BR /&gt;make: *** [src/subdir.mk:20: src/main.o] Error 1&lt;BR /&gt;make: *** Waiting for unfinished jobs....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2024 11:59:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-Design-Studio/Where-is-libc-init-array-defined/m-p/1954260#M12657</guid>
      <dc:creator>oscar_abn</dc:creator>
      <dc:date>2024-09-13T11:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: Where is _libc_init_array() defined?</title>
      <link>https://community.nxp.com/t5/S32-Design-Studio/Where-is-libc-init-array-defined/m-p/1956507#M12658</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;_libc_init_array is part of STD C library (for example libc_nano.a). If you are using C++ you don't need link STD C Library and call _libc_init_array.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2024 09:34:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-Design-Studio/Where-is-libc-init-array-defined/m-p/1956507#M12658</guid>
      <dc:creator>jiri_kral</dc:creator>
      <dc:date>2024-09-18T09:34:12Z</dc:date>
    </item>
  </channel>
</rss>

