Skip to content

Adding simple cffi example. #5

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

jcward
Copy link
Contributor

@jcward jcward commented Mar 9, 2016

Known issues to be reviewed:

  • hardcoded Linux64 path in hx/build.hxml (copying the ndll to the output directory, not sure how to do this cross-platform in an hxml?)
  • directory naming conventions, .gitignore conventions
  • added a try/catch on lib load, could remove for the simple example
  • tried to structure the Build.xml in a way that would make it easy for a beginner to alter and reuse

Known issues:
- hardcoded Linux64 in hx/build.hxml (copying the ndll to the output directory, not sure how to do this cross-platform in an hxml?)
- directory naming conventions, .gitignore conventions
@ruby0x1
Copy link
Member

ruby0x1 commented Mar 9, 2016

Will have a closer look soon:

  • ${BINDIR} is a predefined variable to the Windows/Windows64/Mac/Mac64/Linux/Linux64/Android/iPhone/Other folder distinctions, so you can use it instead of explicitly stating them all

@ruby0x1
Copy link
Member

ruby0x1 commented Mar 9, 2016

  • You're not supposed to include the toolchains directly, BuildCommon does this based on your flags

@ruby0x1
Copy link
Member

ruby0x1 commented Mar 9, 2016

  • Does adding $ORIGIN make sense on the dll itself? Isn't that meant to be configured on the haxe target, so the resulting EXE can import it relative - and in my view - would be a user decision to include not a random ndll that is being included to add?

@jcward
Copy link
Contributor Author

jcward commented Mar 9, 2016

@underscorediscovery I defer to your experience on all counts. I was merely cobbling together something that built, based on Lars' SteamWrap and the old Haxe example (which has minimal build info).

I'll look into applying your notes this afternoon (~8 hours from now.)

@ruby0x1
Copy link
Member

ruby0x1 commented Mar 9, 2016

No worries!

@larsiusprime
Copy link
Collaborator

Nicely done, once we have this we can add a few CFFI Prime examples too. Will be happy to get the build process isolated and explained.

@jcward
Copy link
Contributor Author

jcward commented Mar 10, 2016

Hmm, when I took out the explicit toolchain includes, I got:

>haxelib run hxcpp Build.xml
Error: Compiler element defined without 'exe' attribute included from:[Build.xml]

Ideas?

WRT $ORING -- oh, that's a Steam thing, right, and should be removed. It allowed SteamWrap to link in the steam libraries. Removed.

@ruby0x1
Copy link
Member

ruby0x1 commented Mar 10, 2016

The rpath set to ORIGIN allows the executable typically to pick up libraries relative to the binary itself yea.

You aren't specifying a target to hxcpp so it's probably uncertain what to include, but specifying the explicit toolchains is definitely not what you do.

Try for instance haxelib run hxcpp Build.xml -Dlinux or android,mac,windows etc.

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.

3 participants