K32L2B21:How to complete to call static constructors

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

K32L2B21:How to complete to call static constructors

ソリューションへジャンプ
3,318件の閲覧回数
rodger_an
Contributor I

Hello,

For C++ project, how to complete the constructors function call in start up file?

0 件の賞賛
返信
1 解決策
3,259件の閲覧回数
ErichStyger
Specialist I

Hi @rodger_an ,

not sure if I understood your question. But you might have a look at my blog article on a related subject: https://mcuoneclipse.com/2020/07/11/from-c-to-c-converting-eclipse-c-projekts/

See the section about the C++ startup code.

The thing is that you can call the constructor initialization for global objects in the startup code, but this depends on the standard library used.

I hope this helps,

Erich

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
3,260件の閲覧回数
ErichStyger
Specialist I

Hi @rodger_an ,

not sure if I understood your question. But you might have a look at my blog article on a related subject: https://mcuoneclipse.com/2020/07/11/from-c-to-c-converting-eclipse-c-projekts/

See the section about the C++ startup code.

The thing is that you can call the constructor initialization for global objects in the startup code, but this depends on the standard library used.

I hope this helps,

Erich

0 件の賞賛
返信
3,235件の閲覧回数
rodger_an
Contributor I

Thank you! ErichS.

Now I know the Cpp start up file . And know how to generate a ld script for C++ project.

rodger_an_0-1639735505362.png

 

0 件の賞賛
返信
3,269件の閲覧回数
jingpan
NXP TechSupport
NXP TechSupport

Hi @rodger_an 

You can create a function which call the constructor in main.c. Then call this function in startup file. This function must be called after everything initialized.

 

Regards,

Jing 

0 件の賞賛
返信
3,233件の閲覧回数
rodger_an
Contributor I

Hi JINGPAN,

Thanks for your direction.

 

0 件の賞賛
返信