@@ -284,34 +284,30 @@ pub fn build(b: *std.Build) void {
284284 });
285285 }
286286
287- // Build the examples
288287 {
289- const screen_play = b .addExecutable (.{
290- .name = "screen_play " ,
288+ const video_play = b .addExecutable (.{
289+ .name = "video-play " ,
291290 .root_module = b .createModule (.{
291+ .root_source_file = b .path ("src/video_play.zig" ),
292292 .target = target ,
293293 .optimize = optimize ,
294294 }),
295295 });
296- screen_play .addCSourceFile (.{
297- .file = b .path ("src/screen-play.c" ),
298- });
299- b .installArtifact (screen_play );
300-
301- screen_play .linkLibC ();
302296
303297 const sdl = b .dependency ("sdl" , .{
304298 .optimize = optimize ,
305299 .target = target ,
306300 });
307- screen_play .linkLibrary (sdl .artifact ("SDL3" ));
301+
302+ video_play .linkLibrary (sdl .artifact ("SDL3" ));
303+ b .installArtifact (video_play );
308304
309305 var dep : std.Build.Dependency = .{ .builder = b };
310- linkAndInstall (b , & dep , screen_play );
306+ linkAndInstall (b , & dep , video_play );
311307
312- const run_step = b .step ("screen -play" , "Run the screen -play example" );
308+ const run_step = b .step ("video -play" , "Run the video -play example" );
313309
314- const run_cmd = b .addRunArtifact (screen_play );
310+ const run_cmd = b .addRunArtifact (video_play );
315311 run_cmd .setCwd (.{ .cwd_relative = b .getInstallPath (.bin , "" ) });
316312 run_step .dependOn (& run_cmd .step );
317313
@@ -349,6 +345,18 @@ const flags: []const []const u8 = &.{
349345 "-Wno-pedantic" ,
350346 "-D_GNU_SOURCE" ,
351347 "-DFASTPATH" ,
348+ // Translate C can't translate some of the variadic functions API so they get demoted to
349+ // externs. However, since they're present only in headers and marked as `SPA_API_IMPL` which
350+ // which defaults to `static inline`, the symbols end up being missing. We instead mark them as
351+ // weak so that we don't get duplicate symbols, but are still able to reference the C
352+ // implementations.
353+ "-DSPA_API_IMPL=__attribute__((weak))" ,
354+
355+ "-Ddlopen=__wrap_dlopen" ,
356+ "-Ddlclose=__wrap_dlclose" ,
357+ "-Ddlsym=__wrap_dlsym" ,
358+ "-Ddlerror=__wrap_dlerror" ,
359+ "-Ddlinfo=__wrap_dlinfo" ,
352360};
353361
354362pub const PluginAndModuleCtx = struct {
0 commit comments