-
-
Notifications
You must be signed in to change notification settings - Fork 418
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
Undefined reference to `Main_runtime_override_defaults_oo' #3464
Comments
After looking at this, I believe you are required to add the function yourself in your case at the moment. @jemc do you concur based on looking at how it currently exists? |
Yeah, based on how it currently exists, doing what OP called "the dumbest thing possible" is the correct way to get this to work. That is, adding a definition like this will make it work: void Main_runtime_override_defaults_oo(void* opt)
{
(void)opt; // avoid warning/error about unused variable
return;
} Currently, this works in Pony programs by the Pony compiler generating a default implementation of this method if the program had none: ponyc/src/libponyc/pass/sugar.c Lines 112 to 116 in b6265be
For more general info about this feature, see https://github.com/ponylang/ponyc/blob/b6265be32d39b371a1b4b9f8dba8cf71c74fd578/packages/builtin/runtime_options.pony Is this the cleanest way this feature could have been implemented? Maybe not, because it makes some assumptions about only using the Pony runtime with the It might be worth revisiting how this might be implemented in a cleaner way. |
Just want to point out that I didn't mean "the dumbest thing possible" in a derogatory way, I'm just not much of a C programmer so I don't know what makes sense. Thanks! |
Yeah, I didn't take it in a derogatory way - I just found it to be a funny situation and was glad to see that you got the workaround right on your first try. |
From the very early days of the Pony runtime, a "library mode" has been around that allows you to compile a Pony program to a C compatible library that you can then start up using various runtime APIs to do things like initialize the runtime, create actors, send messages and more. We've made extensive changes to the runtime over the years and have no faith that library mode and its related functionality work. Our lack of faith extends back many years and we've stated as the Pony core team that we don't consider library mode to be supported; until now, we haven't done anything about what "not supported" means. This commit is the first move in removing support for using the Pony runtime via the various untested C API functions. Additional changes will be made to take various PONY_API methods that we consider to be "internal only" and rename them to be `ponyint_` to clarify that they aren't intended for calling from external source and to remove PONY_API methods that aren't used internally by the runtime or the standard library. Closes #3464 Closes #1882
I am just trying to get basic C linking working.
Upfront, this is the error:
Main_runtime_override_defaults_oo
was added recently in 0.33.0 so I'm guessing it just isn't exposed correctly inlibponyrt.a
I think this is easy for Pony developers to reproduce, but just in case I'm doing something wrong, here is what I did:
I have a tiny Pony file called
try_pony.pony
:I compile it with
ponyc --library
to gettry_pony.h
andlibtry_pony.a
.Then I have a tiny C file called
test.c
:Then I compile like this:
This results in the error above.
Now, if I do the dumbest thing possible and add this to my C file:
Then it compiles fine.
The text was updated successfully, but these errors were encountered: