I’m using c api to make a playdate game with Visual Studio 2019 on Windows 10. Installed Playdate SDK 1.7.0 on PC as well as updated console to 1.7.0 version.
After compiling c game, the created .pdx file is running fine on simulator. But when I try to run same .pdx on console, it shows CAPI handler function wasn’t located in loaded data on screen. The game doesn’t run.
Any clue what might be up with it? I can provide more info, but not sure what to look for. So feel free to ask.
You have this message usually when the game doesn’t include binaries build for the device using the arm toolchain. Until know visual was probably just building you c code in a dll that is loaded by the simulator. The playdate cannot load that dll.
To build the arm binaries depends a bit of how you are setup but from the documentation, if you used visual studio, it seems you just need to build a Release version.
I used cmake .. to generate Visual Studio project. And I selected Release from Solution Configuration dropdown menu to build the game. But still no luck.
For second test, I used cmake -DCMAKE_BUILD_TYPE=Release .. to generate Visual Studio project. But got CMake Warning,
Manually-specified variables were not used by the project:
So no luck there. Though it’d align with your observation that for Visual Studio, maybe all I’m supposed to need is select Release config from IDE.
Third test, and only way I was able to run Hello World template project on device is by using nmake to build .pdx. On Inside Playdate with C.html, that’s
4.5 Building for the Playdate using NMake
My current project has multiple .c files as sources though. Not sure what updates I need to make in CMakeLists.txt to have nmake recognize all the other c files & not only main.c. If building through nmake works for this project, that’s fine too.
Thanks for that CMakeLists.txt! Using aux_source_directory worked nicely for me. Previously I tried manually typing in all the .c files but nmake was failing because of different reason. It turns out if I don’t have Source folder created manually, nmake fails with bunch of error about not being able to access files from it. I got one way of making Playdate builds sorted out now, at least.
About the Visual Studio’s Release build output, let me get back to you next week. My guess is VS don’t switch to arm-gcc compiler on Release config and it keeps using whatever the default Microsoft c compiler it is configured to use (same as Debug builds).
VS doesn’t switch to the arm compiler for release builds (it doesn’t know anything about gcc-arm), so you will need to use the arm toolchain directly. The easiest way is using a cmake file with the arm toolchain option which is outlined in the inside C docs.