Skip to content

Adding simple cffi example.#5

Open
jcward wants to merge 2 commits into
snowkit:masterfrom
jcward:master
Open

Adding simple cffi example.#5
jcward wants to merge 2 commits into
snowkit:masterfrom
jcward:master

Conversation

@jcward

@jcward jcward commented Mar 9, 2016

Copy link
Copy Markdown
Contributor

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

ruby0x1 commented Mar 9, 2016

Copy link
Copy Markdown
Member

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

ruby0x1 commented Mar 9, 2016

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

@ruby0x1

ruby0x1 commented Mar 9, 2016

Copy link
Copy Markdown
Member
  • 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

jcward commented Mar 9, 2016

Copy link
Copy Markdown
Contributor Author

@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

ruby0x1 commented Mar 9, 2016

Copy link
Copy Markdown
Member

No worries!

@larsiusprime

Copy link
Copy Markdown
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

jcward commented Mar 10, 2016

Copy link
Copy Markdown
Contributor Author

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

ruby0x1 commented Mar 10, 2016

Copy link
Copy Markdown
Member

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