|
|
Home » U++ Library support » U++ Core » Incorrect implementation of INITBLOCK (and similar macros) in case when flagBLITZ is not defined.
Incorrect implementation of INITBLOCK (and similar macros) in case when flagBLITZ is not defined. [message #16423] |
Fri, 13 June 2008 21:33 |
Novo
Messages: 1371 Registered: December 2006
|
Ultimate Contributor |
|
|
In such situation MK__s is defined as:
#define MK__s MK__s_(__LINE__)
And that means that INITBLOCK must always be put on lines with different line numbers (not just in one file, but in all files).
Otherwise INITBLOCK will produce functions having the same name, and as a result duplicate symbol names.
This issue prevents me from compiling of U++ using MSVC project files. (Have no idea how TheIDE does that.)
I’ve tried to improve INITBLOCK using __COUNTER__ macro, but couldn’t succeed in that.
Regards,
Novo
[Updated on: Fri, 13 June 2008 22:13] Report message to a moderator
|
|
|
|
Re: Incorrect implementation of INITBLOCK (and similar macros) in case when flagBLITZ is not defined [message #16444 is a reply to message #16441] |
Mon, 16 June 2008 06:05 |
Novo
Messages: 1371 Registered: December 2006
|
Ultimate Contributor |
|
|
luzr wrote on Sun, 15 June 2008 13:18 | INITBLOCK creates static variables, these should not be visible outside the file compiled (as long files are not combined using BLITZ - and that is why there is that crazy workaround).
Mirek
|
And this workaround is working fine with UPP build system. But this approach is not working with init-files. I do not have a self-explanatory test case right now, but I'll try to prepare one.
Regards,
Novo
|
|
|
|
|
Re: Incorrect implementation of INITBLOCK (and similar macros) in case when flagBLITZ is not defined [message #31810 is a reply to message #16471] |
Tue, 29 March 2011 13:10 |
|
kohait00
Messages: 939 Registered: July 2009 Location: Germany
|
Experienced Contributor |
|
|
this is still an issue though..
using MSC optimal, which may not use BLITZ, we end up with broken INITBLOCKs..because no index. compiling MSC9 with BLITZ my app works, with optimal and thus without BLITZ the app doesnt.
any idea how to make this work?
BTW: at which point the init files are used? in the ide oder somewhere in the code?
EDIT: in another thread i found that init files are only used with BLITZ, is that right? so thats why no BLITZ_INDEX__ to meangle the static names
but i still wonder, why it doesnt work, if the problem described in the thread only arised with blitz..and i am needing blitz to make it work..sth is weired here
[Updated on: Tue, 29 March 2011 14:06] Report message to a moderator
|
|
|
|
Re: Incorrect implementation of INITBLOCK (and similar macros) in case when flagBLITZ is not defined [message #31813 is a reply to message #31811] |
Tue, 29 March 2011 14:59 |
|
kohait00
Messages: 939 Registered: July 2009 Location: Germany
|
Experienced Contributor |
|
|
thanks mirek, for the hint.
searched a bit in forum, seems i found sth related. please verify, this might / should go to documentation.
i've got some custom init code in a package, packed into a INITBLOCK, this all resides in a cpp file with appearently no referencing from other code, simple global/static init code.
did work with BLITZ, on both MSC and GCC in debug compile however in release, MSC didnt work, since i had to turn off BLITZ. with gcc it also only works with BLITZ enabled. so turning off BLITZ may possibly break INITBLOCK sections in one's app.
solution: i renamed the cpp file with the INITBLOCK code into .icpp file and woops, it works in MSC optimal without blitz. this assures the cpp file wont get kicked out by linker, since its code is not referenced by anything from another code section in app.
is this a general behaviour? can it be considered rule of thumb to rename the INITBLOCK containing cpp file to icpp file, if there is nothing in the file which will guarantee it's presence in linker later, like i.e. referenced code. if so, maybe this should be outlined somewhere in the docu
hints in: http://www.ultimatepp.org/forum/index.php?t=msg&goto=811 8&
[Updated on: Tue, 29 March 2011 15:28] Report message to a moderator
|
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Fri Nov 01 00:51:29 CET 2024
Total time taken to generate the page: 0.03057 seconds
|
|
|