-
Notifications
You must be signed in to change notification settings - Fork 26
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
Add ability to declare C dependencies #10
Comments
Let's add this as top-level constructs, i.e. on the same level as class-declarations. We're going to need the same kind of machinery when we do imports and stuff anyway.
|
Sounds good. |
I can take care of this tomorrow. |
Great! Thanks! |
Although prettier, @EliasC's approach lacks power. I'm going to implement a toplevel embed statement that let's you merge in C code, just as @TobiasWrigstad suggested originally. Example use case: some libs require you to use a preprocessor |
Agreed! This will also allow you to define C-functions in your program, which could be useful! |
You can now have one embed block at the beginning of each file: embed int foo(int x) { return 2*x; } end class Main def main() : void print embed int foo(2); end This program should output: 4 when run.
You can find the test of the feature here: https://github.com/parapluu/mylittlepony/blob/a7234e492d35cca65a252c2a942d4e0dca62ebcc/src/tests/encore/basic/embed-tl.enc |
I am not sure it was correct to close this one. I believe what you have done is very useful (THANKS!), but it is not all what this ticket was about. This allows me to do includes at the top-level which is great, but it does not take care of the lib part, which was more about telling the encore compiler what compilation string to generate with libraries, etc. Granted, the most urgent part is done, but let's make sure the other part is at least discussed and not lost. |
Looks like we are after an FFI between Encore and C. Adriaan has expertise in this area. Sent from my iPhone On 20/07/2014, at 19:03, TobiasWrigstad notifications@github.com wrote:
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm |
The lib dependency shouldn't be addressed on per file based. The included It's possible that one lib is shared by multiple units in one project, and
|
The embed is just a hacky way to get around stuff that we currently do not have. Your comments might be valid if we were talking about a more mature feature. Right now, we are just trying to get stuff to run. Once we are at the stage where there could even be one "project", we can revisit this. If we build a C FFI we do this good. Right now, we move forward. No external dependencies. |
But hacky features also need to be implemented in a specific way. What should the linker flags be if two equal-named As we already have a |
I wasn't aware we could compile different files at the same time. Can we? |
We can not. |
No, but we're planning to do that soon, was my view. Anyway, I just pushed a small temporary fix (41b00ee) that changes the compiler to use the I'm reopening this ticket now. |
Thanks @kaeluka! I'll look at the temp fix. I suggest we might not look at how to fix this the coming week, but put several tickets in the system for compiling multiple files, C FFI, the works. The most urgent thing, though is a very short language spec that documents how Encore works. |
@TobiasWrigstad see #17 |
@kaeluka What is the status of this? Can this be closed? |
Thanks you! |
Non-trivial use of
embed
...end
requires ability to include header files and also build dependencies. A possible mock syntax would be to enablelib
andinc
statements insideembed
blocks, e.g.,The goal is to be able to skip having to generate a C file and manually edit it and compile it.
The text was updated successfully, but these errors were encountered: