Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user_main.h improvement #449

Open
fabriceo opened this issue Jan 6, 2025 · 1 comment
Open

user_main.h improvement #449

fabriceo opened this issue Jan 6, 2025 · 1 comment

Comments

@fabriceo
Copy link

fabriceo commented Jan 6, 2025

Hello,
including declartion and cores in lib_xua/main.xc is done via 2 macros defined in user_main.h.
This file name is defined in the OPTIONAL_HEADERS in file lib_xua/module_build_info, and also in LIB_OPTIONAL_HEADERS in lib_xua/lib_build_info.cmake

A better solution, while retro compatible, would be to have separated .h files for the declarations and cores section, instead of basic text written in #define statements.

I suggest to add the files user_main_declarations.h and user_main_cores.h in the list of optional headers, and to add following piece of code in the main.xc file:


#ifdef __user_main_declarations_h_exists__
    #include "user_main_declarations.h"
#endif

    USER_MAIN_DECLARATIONS

    par
    {
#ifdef __user_main_cores_h_exists__
    #include "user_main_cores.h"
#endif
        USER_MAIN_CORES

This provide a more flexible and powerfull solution to change the content of main.xc and the original user_main.h solution remains, which is useful for declaring globals or include statements in the top of main.xc

@xross
Copy link
Collaborator

xross commented Jan 6, 2025

Look like a good suggestion to me, would be happy to accept a PR with this change.

The documentation would need a related update too, of course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants