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

What about native extensions? #2

Open
JeriXNet opened this issue Feb 12, 2016 · 5 comments
Open

What about native extensions? #2

JeriXNet opened this issue Feb 12, 2016 · 5 comments
Labels

Comments

@JeriXNet
Copy link

I've seen google group theme about native extensions formalization over different haxe frameworks or something like that... I just can't find it right now :(

@ruby0x1
Copy link
Member

ruby0x1 commented Feb 12, 2016

This repo/guide will be more specific to hxcpp itself, extensions are a bit higher level than that.

There is ongoing work on the above mentioned concepts though, more information about that will be made available soon. It requires a lot of moving parts and to get it done right it takes patience.

@ruby0x1
Copy link
Member

ruby0x1 commented Feb 14, 2016

I should note btw, that extensions are typically made up of CFFI bindings, are typically built using the HXCPP build tools - this guide will definitely cover these parts on their own so you can easily understand and create extensions. The specifics about extensions that relate to using them in frameworks is unrelated to the hxcpp guide - is what I meant!

@kevinresol
Copy link

kevinresol commented Feb 14, 2017

I would also like to see some guides about data types conversions between haxe and cpp, more for linc than CFFI.

  • Some of them are easy, like haxe Bool = cpp bool.
  • But some are not, e.g. haxe String vs cpp const char* or std::string or ::String?
  • And Arrays.
  • haxe cpp.Pointer vs cpp *
  • cpp::Struct is basically documented in nowhere. I mostly learn from the source code of existing linc libraries. I think there are some implicit conversion happening in c++ (say struct can become ::cpp::Struct) But since I am no good c/c++ programmer, I don't really know why it behaves like so.

Info on memory management between haxe/cpp will also be very useful.

@ruby0x1
Copy link
Member

ruby0x1 commented Feb 14, 2017

Some of these are a good idea to be have a short guide on!

I will mention again though that they might not be what documented as you might expect.
I mentioned in the docs: this guide will not be able to document c++ itself. It is impractical to make a body of work teaching everything you need to know in c++ first. Yet, in order to effectively use a c++ specific interface you must learn about c++ concepts and fundamentals.

It is for this reason that many things can feel undocumented, like there is a lot of "missing pieces", but a large percent of this knowledge doesn't come from hxcpp, it comes from knowing c++, then you can see how the hxcpp things relate.

There are many undocumented things on top of that (in hxcpp usage), which this guide targets.
The goal of the guide here is to talk about the behaviour of concepts like these with hxcpp, but without understanding some of the c++ concepts first though, you will probably still feel the same way.

The guide tries to be approachable though, so hopefully it helps a little in both ways!

@kevinresol
Copy link

this guide will not be able to document c++ itself

Yeah I understand that. What I really meant is to have some guides on the precautions to be taken when working between c++ and hxcpp. To be more specific, let me rephrase some parts of my last post:

Memory Management: hxcpp is a GC environment, which should we do when passing values/references/pointers to and from hxcpp and plain c++?

How to convert types between hxcpp and c++ or use haxe type directly (or indirectly) in plain c++ (and vice versa)? On haxe side we have Array, String, Dynamic, Anonymous object, Function. On c++ side we have "raw" array (like int[10]), std::array, std::vector, const char*, std::string, struct, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants