defold-native-extension-editing

Guide creation and editing of Defold native extensions with C/C++ and JavaScript.

11|Updated Oct 10, 2024
One-click install
npx skills add https://github.com/selimanac/defold-daabbcc3d --skill defold-native-extension-editing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: defold-native-extension-editing
Source: https://github.com/selimanac/defold-daabbcc3d/tree/main/.agents/skills/defold-native-extension-editing
Command: npx skills add https://github.com/selimanac/defold-daabbcc3d --skill defold-native-extension-editing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Defold native extension development can be complex, requiring correct project structure, manifest configuration, and cross-language integration. This Skill provides a structured guide to help developers create or edit native extensions for Defold more efficiently.

Core Features & Use Cases

  • Structured extension layout: explains required folders (src/, include/, lib/, api/) and ext.manifest, ensuring project consistency across teams.
  • Manifest and platform support: demonstrates how to populate ext.manifest for multiple targets and how to link platform libraries.
  • Code patterns and examples: provides entry-point examples in C++ and HTML5, illustrating how to initialize the extension and expose Lua APIs.
  • Best practices: covers dmSDK usage, safe Lua callbacks, and cross-platform considerations.

Quick Start

Create a new extension folder with ext.manifest and at least a src/ directory, then implement your C/C++ or JavaScript code and manifest entries following the examples.

Frequently Asked Questions about defold-native-extension-editing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a Defold native extension project using C++ and JavaScript?

A Defold native extension requires a specific folder layout with src/, include/, lib/, and api/ directories, plus an ext.manifest file. You implement C++ or JavaScript code in src/ and define Lua API bindings in the api/ folder.

What is the ext.manifest file used for in Defold extension development?

The ext.manifest file configures your Defold native extension by defining platform targets and linking platform libraries. It ensures your extension builds correctly across multiple platforms and integrates with the dmSDK.

How do I expose a Lua API from a Defold native extension entry point?

You expose a Lua API from a Defold native extension by implementing entry-point code in C++ or HTML5 and following dmSDK patterns. This involves initializing the extension and using safe Lua callbacks to bridge functionality.

Does Defold native extension development support both C/C++ and HTML5 targets?

Yes, Defold native extension development supports building cross-platform extensions using C/C++ and JavaScript. The structure includes code patterns and entry-point examples specifically for initializing extensions and exposing Lua APIs on HTML5.

What are the best practices for organizing src, include, and lib folders in a Defold extension?

Best practices for Defold extension organization involve maintaining consistent src/, include/, and lib/ folders to separate source code, headers, and platform libraries. Following dmSDK patterns ensures safe Lua callbacks and proper cross-platform integration.

Can I use dmSDK patterns to handle cross-platform considerations in Defold native extensions?

Yes, dmSDK patterns are specifically recommended for handling cross-platform considerations in Defold native extensions. They provide standardized methods for initializing extensions, executing safe Lua callbacks, and ensuring consistent behavior across different platforms.