K32L2B21:How to complete to call static constructors

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

K32L2B21:How to complete to call static constructors

Jump to solution
3,070 Views
rodger_an
Contributor I

Hello,

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

0 Kudos
Reply
1 Solution
3,011 Views
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

View solution in original post

0 Kudos
Reply
4 Replies
3,012 Views
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 Kudos
Reply
2,987 Views
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 Kudos
Reply
3,021 Views
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 Kudos
Reply
2,985 Views
rodger_an
Contributor I

Hi JINGPAN,

Thanks for your direction.

 

0 Kudos
Reply