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

Can't specify output file #1306

Closed
programmerlexi opened this issue Aug 4, 2024 · 11 comments
Closed

Can't specify output file #1306

programmerlexi opened this issue Aug 4, 2024 · 11 comments
Assignees
Labels
Enhancement Request New feature or request Fixed Needs Verification Fixed, but needs verification that it works In Progress This task is currently being worked on

Comments

@programmerlexi
Copy link

When using the -o option the passed file is ignored and the compiled program isn't beign saved at all.

@chuckb
Copy link
Contributor

chuckb commented Aug 4, 2024

You most likely don't have a main and so your code is being optimized away. I encounter this when using --no-stdlib --no-entry --static-lib. Try adding an @export("symbol_name_here") after a function declaration (before the implementation).

@lerno lerno added the Additional info please Further information is requested label Aug 5, 2024
@lerno
Copy link
Collaborator

lerno commented Aug 5, 2024

Can you give more information on what your setup is?

@programmerlexi
Copy link
Author

This happens when using compile-only to compile c3 into an object file. I'm on linux.

@lerno
Copy link
Collaborator

lerno commented Aug 5, 2024

Ok, this will happen, because just like C, compiling multiple files yields multiple object files. If you use --single-module=yes, then this will work, since it outputs a single file.

@programmerlexi
Copy link
Author

  1. Compiling multiple files in C does not yield multiple object files.
  2. With --single-module=yes it still doesn't work.

@lerno
Copy link
Collaborator

lerno commented Aug 5, 2024

  1. It does if you compile them separately as one usually does.
  2. If you do --single-module, don't you get a single .o file at least?

@programmerlexi
Copy link
Author

I only get the compiled version of the standard library.

@lerno
Copy link
Collaborator

lerno commented Aug 5, 2024

Hmm.. so wait, what are you trying to achieve here? Maybe I misunderstand. Are you just compiling the exe and it's not using the -o, or are we talking about the object files not matching the name? There are a lot of ways to do different things depending on what you're after.

@programmerlexi
Copy link
Author

programmerlexi commented Aug 6, 2024

I'm trying to compile c3 code for linking with other object files. While giving the object file a specific name.

@lerno lerno self-assigned this Aug 6, 2024
@lerno lerno added In Progress This task is currently being worked on Bug Something isn't working Enhancement Request New feature or request and removed Additional info please Further information is requested Bug Something isn't working labels Aug 6, 2024
@lerno
Copy link
Collaborator

lerno commented Aug 7, 2024

@truemaker The (final) .o file when using --single-module=yes is now using the -o name. Please try the lastest build.

@lerno lerno added the Fixed Needs Verification Fixed, but needs verification that it works label Aug 7, 2024
@programmerlexi
Copy link
Author

Works good enough

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Request New feature or request Fixed Needs Verification Fixed, but needs verification that it works In Progress This task is currently being worked on
Projects
None yet
Development

No branches or pull requests

3 participants