Tensegritics / ClojureDart

Clojure dialect for Flutter and Dart
1.38k stars 88 forks source link

ffi sample #274

Closed anatoly62 closed 9 months ago

anatoly62 commented 9 months ago

How to lookup function with arguments?

TiLogic commented 9 months ago

I don't know of a ClojureDart example, but a Dart example of functions with arguments can be found here.

The ClojureDart authors may be able to help here...

You might be interested in the ffigen package. Which parses C header files and generates a Dart API, which you can then call from ClojureDart. It's much easier than writing it manually.

anatoly62 commented 9 months ago

Thanks, I see that, but an ClojureDart example is needed.

dupuchba commented 9 months ago

hello @anatoly62 & @TiLogic - there is an example of simple ffi in the repo, using ffigen in cljd is no different from Dart itself. Thanks for the suggestion to make a new sample for ffigen, I'll try to do it this week. We're also preparing the next newsletter release and it'll be on ffi & ffigen. Should be out next week. Thanks for your support

dupuchba commented 9 months ago

back to your problem @anatoly62 - here is a full example with ffigen. https://github.com/Tensegritics/ClojureDart/tree/main/samples/fficjson Don't hesitate to ask questions on the channel if you need to