Skip to content

Add implot-sys and implot3d-sys - #22

Merged
jeaye merged 2 commits into
jank-lang:mainfrom
kylc:implot
Oct 11, 2026
Merged

jeaye merged 2 commits into
jank-lang:mainfrom
kylc:implot

Conversation

@kylc

@kylc kylc commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Depends on #18. Note the TODOs in the example.

@kylc kylc changed the title Add implot-sys Add implot-sys and implot3d-sys Oct 10, 2026
@kylc

kylc commented Oct 10, 2026

Copy link
Copy Markdown
Contributor Author

Fancy

image

@jeaye

jeaye commented Oct 11, 2026

Copy link
Copy Markdown
Member

Fancy
image

Fancy!

Comment on lines +9 to +10
;; TODO: jank can't deduce the template scalar type on ImPlot::PlotLine yet, so
;; specify it explicitly here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you see a different error here than the vector JIT linker error?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

;; OK
(cpp/raw "
void foo() {
  std::vector<double> xs{};
  std::vector<double> ys{};
  ImPlot::PlotLine(\"my line\", xs.data(), ys.data(), 0);
}
")

;; Compile error
(let [xs (#cpp (std.vector double))
      ys (#cpp (std.vector double))]
  (cpp/ImPlot.PlotLine "my line" (.data xs) (.data ys) 0))

In file included from <<< inputs >>>:1:
In file included from /build/source/compiler+runtime/src/jank/clojure/core.jank:5738:
/home/kyle/code/jank/projects/commons/implot-sys/example/target/debug/_cache/implot-sys-0.1-SNAPSHOT-out-2z1gAtZL17Ii7DlpgsJ4gQ/include/implot.h:990:17: error: 
      explicit instantiation of undefined function template 'PlotLine'
  990 | IMPLOT_TMP void PlotLine(const char* label_id, const T* xs, const T* ys, int count, const ImPlotSpec& spec=ImPlo...
      |                 ^
/home/kyle/code/jank/projects/commons/implot-sys/example/target/debug/_cache/implot-sys-0.1-SNAPSHOT-out-2z1gAtZL17Ii7DlpgsJ4gQ/include/implot.h:990:17: note: 
      explicit instantiation refers here
─ analyze/invalid-cpp-call ─────────────────────────────────────────────────────────────────────────
error: Unable to instantiate template.

─────┬──────────────────────────────────────────────────────────────────────────────────────────────
     │ src/implot_sys/example.jank
─────┼──────────────────────────────────────────────────────────────────────────────────────────────
 27  │             (cpp/sin (+ (* ω t) ϕ))))))
 28  │ 
 29  │ (let [xs (#cpp (std.vector double))
     │ ^ Expanded from this macro.
 30  │       ys (#cpp (std.vector double))]
 31  │   (cpp/ImPlot.PlotLine "my line" (.data xs) (.data ys) 0))
     │    ^^^^^^^^^^^^^^^^^^^ Found here.
─────┼──────────────────────────────────────────────────────────────────────────────────────────────
  🗎  │ https://book.jank-lang.org/reference/error/analyze/invalid-cpp-call.html
─────┴──────────────────────────────────────────────────────────────────────────────────────────────

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. I've been able to reproduce it outside of implot locally. It's now ticketed here: jank-lang/jank#1082

@kylc
kylc force-pushed the implot branch 2 times, most recently from efb3855 to 31398f5 Compare October 11, 2026 19:32
@kylc

kylc commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

Rebased and bumped lein-jank/jank-build versions

@jeaye jeaye left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@jeaye
jeaye merged commit 8b9b58d into jank-lang:main Oct 11, 2026
4 checks passed
@jeaye

jeaye commented Oct 12, 2026

Copy link
Copy Markdown
Member

Published!

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.

2 participants