Skip to content

Conversation

filipsajdak
Copy link
Contributor

When linking multiple cpp2 files cpp2::args(int, char**) symbol appears multiple times causing the followint error message:

[build] duplicate symbol 'cpp2::args(int, char**)' in:
[build]     libs/execspec/CMakeFiles/libexecspec.dir/src/application.cpp.o
[build]     libs/execspec/CMakeFiles/libexecspec.dir/src/compile_cpp2.cpp.o

This change makes cpp2::args(int, char**) an inline function.

When linking multiple cpp2 files cpp2::args symbol
appears multiple times.
@hsutter hsutter closed this in fb4a9fc Mar 9, 2023
@JohelEGP JohelEGP mentioned this pull request Mar 10, 2023
@filipsajdak filipsajdak deleted the fsajdak-fix-args-duplicate-symbol branch March 22, 2023 08:36
zaucy pushed a commit to zaucy/cppfront that referenced this pull request Dec 5, 2023
This is an omnibus commit of the last few evenings' changes. Primarily it was to start laying the groundwork for constructors, but it includes other fixes and closes a few issues.

Details:

- Begin infrastructure preparation for constructors

- Started creating navigation APIs to replace the low-level graph node chasing; this makes cppfront's own code cleaner and the tree easier to change if needed, but it's also a step toward a reflection API

- Extended `main:(args)` to require the name "args" for the single-parameter `main`, and to support `args.argc` and `args.argv`, further on hsutter#262 (see comment thread)

- Changed default return type for unnamed functions to be `-> void`, same as named functions, closes hsutter#257

- Disallow single-expression function body to be just `return`, closes hsutter#267

- Make `make_args` inline, closes hsutter#268

- Bug fix: emit prolog also for single-expression function body. Specifically, this enables main:(args)=expression; to work correctly. Generally, this also corrects the code gen for examples that were trying (but failing) to inject prologs in single-expression functions... in the regression tests this corrected the code gen for `pure2-forward-return.cpp2` which was missing the contract check before.
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

Successfully merging this pull request may close these issues.

2 participants