Home » Developing U++ » U++ Developers corner » Possible solution of "icpp problem"
Possible solution of "icpp problem" [message #46850] |
Sat, 27 August 2016 16:09 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
Hi,
"icpp issue" is longstanding problem that prevents U++ to be used as 'library' without TheIDE.
Brief summary of issue: if file has .icpp extension, U++ builder treats it differently and always includes correspending .obj file into executable. Thus it is possible to put initialization code into it (using fake global constructor). That way, e.g. to support gif Image loading, all that has to be done is just add plugin/gif to project. plufin/gif/gif.icpp contains the code that registers gif format in Draw package.
Now if you rename gif.icpp to gif.cpp, build process will produce .obj and it gets into library, but linker will not link it into .exe because there are no references to functions in plugin/gif.
This was for quite a long time a problem when thinking about "U++ library".
Now I got finally a good idea how to resolve this issue:
We can put static constructor instance into "gif.h" calling required initialization code. That way, #include <plugin/gif/gif.h> will be required in client code, but that is not that much problem (in most cases, such #include will be there anyway) and as library, it is just fitting to include gif header to get gif support.
I can change U++ sources so that .icpp are still supported by U++ builder, but not really required when building outside umk/theide. .icpp will just call the same initialization hook as static constructor in the header (in reality, it will be easier to just call empty function in .cpp that contains INITBLOCK with required initialization...)
What do you think? Should I go that way?
Mirek
|
|
|
|
|
Possible solution of "icpp problem"
By: mirek on Sat, 27 August 2016 16:09
|
|
|
Re: Possible solution of "icpp problem"
|
|
|
Re: Possible solution of "icpp problem"
|
|
|
Re: Possible solution of "icpp problem"
By: mirek on Sun, 28 August 2016 17:49
|
|
|
Re: Possible solution of "icpp problem"
|
|
|
Re: Possible solution of "icpp problem"
|
|
|
Re: Possible solution of "icpp problem"
By: koldo on Mon, 29 August 2016 09:18
|
|
|
Re: Possible solution of "icpp problem"
By: mirek on Thu, 15 September 2016 09:14
|
|
|
Re: Possible solution of "icpp problem"
By: mirek on Sun, 28 August 2016 17:41
|
|
|
Re: Possible solution of "icpp problem"
By: kov_serg on Thu, 22 September 2016 16:44
|
|
|
Re: Possible solution of "icpp problem"
By: mirek on Thu, 22 September 2016 17:02
|
|
|
Re: Possible solution of "icpp problem"
By: kov_serg on Fri, 23 September 2016 00:32
|
|
|
Re: Possible solution of "icpp problem"
By: mirek on Fri, 23 September 2016 09:26
|
|
|
Re: Possible solution of "icpp problem"
By: mr_ped on Sun, 25 September 2016 04:16
|
|
|
Re: Possible solution of "icpp problem"
By: kov_serg on Mon, 26 September 2016 17:05
|
|
|
Re: Possible solution of "icpp problem"
By: mirek on Mon, 26 September 2016 17:43
|
|
|
Re: Possible solution of "icpp problem"
By: kov_serg on Mon, 26 September 2016 18:35
|
Goto Forum:
Current Time: Fri Mar 29 01:44:13 CET 2024
Total time taken to generate the page: 0.01370 seconds
|