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

Allow extern definitions defined outside extern objects #2062

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

WojciechMazur
Copy link
Contributor

@WojciechMazur WojciechMazur commented Dec 10, 2020

This PR implements #897 for extern definitions.
It includes all not yet implemented features from the proposal, that is:

  • @extern object no more.
  • def $name(..$args): $T = extern can appear in any class, module or trait.
  • val $name: $T = extern can appear in any class, module or trait.
  • var $name: $T = extern can appear in any class, module or trait.
  • @link("...") can appear on any class, module, trait, method or field. If the given definition is reachable at link-time, linker >would link with the corresponding native library automatically.

This PR should be followed by changes to #2060 including changes to syntax rules if it would be merged earlier, or should be rebased and adjusted in otherwise.

Copy link
Member

@ekrich ekrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remember to update the documents as this get closer to being final.

val buf1 = stackalloc[Byte](bufsize)
val buf2 = stackalloc[Byte](bufsize)
Ext1.snprintf(buf1, bufsize, c"%s", c"hello")
assertTrue(string.strcmp(buf1, c"hello") == 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you try to change to assertEquals here (and two lines below)?

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.

None yet

3 participants