Use C LIbraries DLL

Hi, I have this folders:

.vscode
bin
src
   Main.hx
   SDL2.dll
build.hxml
README.md

I have this build.hxml:

-cp src
-D analyzer-optimize

-cpp bin

-main Main

How can I use the SDL2.dll in Haxe?

You may want to give the Hashlink SDL bindings a shot first. You can install them with this haxelib: https://lib.haxe.org/p/hlsdl/

Hashlink backend:

The heaps game engine uses these bindings and you can take a look at them being used here: heaps/Window.hl.hx at master · HeapsIO/heaps · GitHub

If you’d rather stick with the C++ target have you considered using a library that already provides similar functionality to SDL such as NME, OpenFL, Kha, Clay?

If you’re really set on using SDL directly take a look at some of these outdated resources:

Clay is heavily inspired by snowkit so dig around that code base to see how Jeremy is using SDL: GitHub - ceramic-engine/clay: Clay is a lightweight toolkit to build apps, games and frameworks on native platforms and web browser, written with the Haxe Programming Language

Or just write your own bindings:

You can try (not yet intended for public use) h-sdl2