Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » Possible solution of "icpp problem"
Re: Possible solution of "icpp problem" [message #46949 is a reply to message #46948] Mon, 26 September 2016 17:43 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
kov_serg wrote on Mon, 26 September 2016 17:05
How about another explicit method

Generate in project dir file like this
// static_init.cpp
#define INIT(lib) extern int lib##_init(); lib##_init();
static int init() {
    INIT(lib1)
    INIT(lib2)
    INIT(lib3)
    // ....
    return 0;
}
static int init_result=init();

and link it to project. Just like .def file.
This is simple and you can control order of initialization. And no need of inline valiables support.


We do not need to control order of initialization. That is pointless as it is easy to write order neutral initialization code.

Other than that, 'link it to the project, just like .def' creates about the same problem as original .icpp - works great if you have control about build process. .icpp is perfect solution to the problem - the only problem is that it is unusual and no other build system supports it. That is something I am trying to solve. People just expect .cpp and .h (or .h and .lib), any other 'magic' is not welcome.

Mirek

P.S.: I have thought about inline variables and I think they are not much advantage over good old global initialization.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [Solved] Instant Upp crash on char input
Next Topic: Parser error: Unterminated string
Goto Forum:
  


Current Time: Mon Apr 29 10:12:14 CEST 2024

Total time taken to generate the page: 0.02650 seconds