HaxeFoundation / HaxeFoundation/haxe

CFFI Prime class is undocumented and very difficult to figure out

Open
#4,752 15 comments 0 reactions 1 assignee Claimed by @hughsando View on GitHub
documentation haxe-foundation-partner platform-cpp platform-neko
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

Is this really ready for use? I can't understand how a feature can be added to the standard library with no in-class documentation explaining in any way how to use it, let alone documentation that is findable from a google search. I have spent about a day wasting my time trying to figure out how to get a native function to load and be callable using CFFI Prime.

Let's examine this class shall we?

There is a _public_ function called "_loadPrime" that _looks_ like it might be the way to load functions using CFFI Prime, but I have never gotten it to work. And then there's the fact that it's named with a leading underscore, which _suggests_ that it's not meant to be called publicly. So is it or isn't it supposed to be public?

There is a _macro_ function called "load" that also looks like it could be the prescribed way to load native functions, but why is it a macro function? That totally hoses my ability to write non-macro helper functions that call this function. At least, this didn't work:

private static function loadFunction(name : String, signature: String)
{
return cpp.Prime.load("myModule", name, signature, true);
}

There is _no_ documentation describing what a "signature" should look like. I think I can tell from READING THE C++ CODE, which should _never_ be a prerequisite for using a standard library function, but even still, the load function is not working as expected so maybe I misread something?

Why is there an "inAllowFail" anyway? Just friggin return null, I don't need you to throw a lame and confusing string on my behalf!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.