us Read English version | 🇪🇸 Leer versión en Español
This tool is a specialized parser and build system written in FreeBASIC that automatically converts the official Raylib and Raygui C headers into FreeBASIC compatible headers (.bi files) and compiles the necessary static libraries.
It creates a seamless bridge between the two languages by generating native headers and libraries, allowing you to use raylib, raymath, rlgl, and raygui directly in your FreeBASIC projects for both x86 (32-bit) and x64 (64-bit) architectures.
-
Complete Module Support: Fully converts the four main modules:
-
raylib.h(Core API) -
raymath.h(Vector/Matrix math) -
rlgl.h(OpenGL abstraction) -
raygui.h(Immediate-mode GUI API)
-
-
Smart Type Mapping: Automatically maps C types to FreeBASIC equivalents (e.g.,
int$\to$ long,const char*$\to$ zstring ptr). -
Struct & Enum Parsing: Correctly translates C structs and enums into FreeBASIC
TypeandEnumblocks. -
Syntax Corrections: Handles naming conflicts automatically (e.g., renaming the C struct
ColortoRayColorto avoid conflicts with FreeBASIC's built-in keywords). -
Static Library Compilation: Automatically compiles header-only C libraries (like Raygui) into ready-to-use
.astatic libraries.
The converter scans the original C header files line-by-line but understands the context. It:
- Identifies version strings automatically.
- Filters out C-specific macros that aren't needed in FB.
- Parses function signatures (handling
RLAPI,RMAPIandRAYGUIAPI). - Skips inline C implementations (specifically for
raymath.handraygui.h) to generate cleanDeclarestatements. - Adds necessary boilerplate code (like
#inclib,extern "C", CRT includes, and Windows system dependencies).
To compile the C implementations (like Raygui) and guarantee compatibility with FreeBASIC's internal linker, you must use GCC versions compiled with MSVCRT (not UCRT).
- MinGW Compilers (WinLibs):
- 32-bit:
winlibs-i686-posix-dwarf-gcc-11.5.0-mingw-w64msvcrt-12.0.0-r1 - 64-bit:
winlibs-x86_64-posix-seh-gcc-11.5.0-mingw-w64msvcrt-12.0.0-r1 - (Note: GCC 8.5 with MSVCRT is also highly recommended for maximum legacy compatibility).
- 32-bit:
- Raylib Static Libraries (
libraylib.a):- Download the official Raylib MinGW releases.
- Place the 64-bit
libraylib.a(fromraylib-x.x_win64_mingw-w64) in thelib_c\x64folder. - Place the 32-bit
libraylib.a(fromraylib-x.x_win32_mingw-w64) in thelib_c\x86folder.
- Raygui Header (
raygui.h):- Download the official Raygui release (
raygui-x.x.zip). - Extract
raygui.hand place it in thesrc_cfolder.
- Download the official Raygui release (
To automate the compilation for both architectures and keep the compilers organized, this system expects the following folder structure on your C:\ drive:
C:\dev\
├── cmd\ (Add this folder to your system PATH)
├── mingw32\ (Extract 32-bit WinLibs MSVCRT here)
└── mingw64\ (Extract 64-bit WinLibs MSVCRT here)
Inside the C:\dev\cmd folder, create the following wrapper .bat files to easily call the compilers:
gcc32.bat:
@echo off
setlocal
set PATH=C:\dev\mingw32\bin;%PATH%
gcc.exe %*
endlocalar32.bat:
@echo off
setlocal
set PATH=C:\dev\mingw32\bin;%PATH%
ar.exe %*
endlocalgcc64.bat:
@echo off
setlocal
set PATH=C:\dev\mingw64\bin;%PATH%
gcc.exe %*
endlocalar64.bat:
@echo off
setlocal
set PATH=C:\dev\mingw64\bin;%PATH%
ar.exe %*
endlocal- Get the Headers: Obtain
raylib.h,raymath.h,rlgl.h, andraygui.h. - Clean Headers: Remove comments from the headers. You can do this automatically using the
remove_comments_h.bastool located in thetoolsfolder. - Place Files: Put all the clean
.hfiles into thesrc_cfolder. - Generate FreeBASIC Bindings: Run
gen-raylib_headers.bat(located in_build_scripts). This will parse the C headers and generate.bifiles. - Compile Raygui Libraries: Run
build-raygui_lib.bat(located in_build_scripts). This will compileraygui.hinto staticlibraygui.alibraries for both x86 and x64 using your GCC setup.
If you followed all steps correctly, you will have a complete, ready-to-use FreeBASIC SDK for both Raylib and Raygui. You can find all the generated files (.bi and .a) inside the sdk_freebasic folder.
If you want to use the FreeBASIC converter tool manually:
# Syntax
converter.exe <input_file.h> <output_file.bi>
# Examples
converter.exe raylib.h raylib.bi
converter.exe raygui.h raygui.bi- WinLibs GCC: https://winlibs.com/
- Raylib Releases: https://github.com/raysan5/raylib/releases
- Raygui Releases: https://github.com/raysan5/raygui/releases
Esta herramienta es un analizador sintáctico (parser) y sistema de compilación escrito en FreeBASIC que convierte automáticamente las cabeceras oficiales en C de Raylib y Raygui en cabeceras compatibles con FreeBASIC (archivos .bi) y compila las librerías estáticas necesarias.
Crea un puente perfecto entre ambos lenguajes al generar cabeceras y bibliotecas nativas, permitiéndote usar raylib, raymath, rlgl y raygui directamente en tus proyectos de FreeBASIC, tanto para arquitecturas x86 (32-bit) como x64 (64-bit).
-
Soporte Completo de Módulos: Convierte totalmente los cuatro módulos principales:
-
raylib.h(API Principal) -
raymath.h(Matemáticas de vectores/matrices) -
rlgl.h(Abstracción de OpenGL) -
raygui.h(API de GUI en modo inmediato)
-
-
Mapeo Inteligente de Tipos: Asigna automáticamente tipos de C a sus equivalentes en FreeBASIC (ej.
int$\to$ long,const char*$\to$ zstring ptr). -
Análisis de Structs y Enums: Traduce correctamente los structs y enums de C en bloques
TypeyEnumde FreeBASIC. -
Correcciones de Sintaxis: Maneja conflictos de nombres automáticamente (ej. renombrar el struct
Colorde C aRayColorpara evitar conflictos con las palabras reservadas de FreeBASIC). -
Compilación de Librerías Estáticas: Compila automáticamente librerías C "header-only" (como Raygui) en librerías estáticas
.alistas para usar.
El convertidor escanea los archivos de cabecera en C originales línea por línea, comprendiendo su contexto para:
- Identificar versiones automáticamente.
- Filtrar macros específicas de C que no son necesarias en FB.
- Analizar firmas de funciones (manejando
RLAPI,RMAPIyRAYGUIAPI). - Omitir implementaciones de C en línea (específicamente en
raymath.hyraygui.h) para generar declaracionesDeclarelimpias. - Añadir código base necesario (como
#inclib,extern "C", dependencias CRT y dependencias del sistema Windows).
Para compilar las implementaciones en C (como Raygui) y garantizar la compatibilidad con el enlazador (linker) interno de FreeBASIC, debes usar versiones de GCC compiladas con MSVCRT (no UCRT).
- Compiladores MinGW (WinLibs):
- 32-bit:
winlibs-i686-posix-dwarf-gcc-11.5.0-mingw-w64msvcrt-12.0.0-r1 - 64-bit:
winlibs-x86_64-posix-seh-gcc-11.5.0-mingw-w64msvcrt-12.0.0-r1 - (Nota: GCC 8.5 con MSVCRT también es muy recomendado para máxima compatibilidad).
- 32-bit:
- Librerías Estáticas de Raylib (
libraylib.a):- Descarga las releases oficiales de Raylib para MinGW.
- Coloca el
libraylib.ade 64-bit (deraylib-x.x_win64_mingw-w64) en la carpetalib_c\x64. - Coloca el
libraylib.ade 32-bit (deraylib-x.x_win32_mingw-w64) en la carpetalib_c\x86.
- Cabecera de Raygui (
raygui.h):- Descarga la release oficial de Raygui (
raygui-x.x.zip). - Extrae
raygui.hy colócalo en la carpetasrc_c.
- Descarga la release oficial de Raygui (
Para automatizar la compilación en ambas arquitecturas y mantener los compiladores organizados en tu equipo, este sistema espera la siguiente estructura de carpetas en tu disco C:\:
C:\dev\
├── cmd\ (Agrega esta carpeta al PATH del sistema)
├── mingw32\ (Extrae aquí el WinLibs MSVCRT de 32-bit)
└── mingw64\ (Extrae aquí el WinLibs MSVCRT de 64-bit)
Dentro de la carpeta C:\dev\cmd, crea los siguientes archivos .bat para llamar fácilmente a los compiladores:
gcc32.bat:
@echo off
setlocal
set PATH=C:\dev\mingw32\bin;%PATH%
gcc.exe %*
endlocalar32.bat:
@echo off
setlocal
set PATH=C:\dev\mingw32\bin;%PATH%
ar.exe %*
endlocalgcc64.bat:
@echo off
setlocal
set PATH=C:\dev\mingw64\bin;%PATH%
gcc.exe %*
endlocalar64.bat:
@echo off
setlocal
set PATH=C:\dev\mingw64\bin;%PATH%
ar.exe %*
endlocal- Obtener las Cabeceras: Consigue los archivos
raylib.h,raymath.h,rlgl.hyraygui.h. - Limpiar Cabeceras: Elimina los comentarios de los archivos
.h. Puedes hacerlo automáticamente usando la herramientaremove_comments_h.basde la carpetatools. - Colocar Archivos: Coloca todas las cabeceras
.hlimpias en la carpetasrc_c. - Generar Cabeceras para FreeBASIC: Ejecuta
gen-raylib_headers.bat(en la carpeta_build_scripts). Esto analizará las cabeceras de C y generará los archivos.bi. - Compilar Librerías de Raygui: Ejecuta
build-raygui_lib.bat(en la carpeta_build_scripts). Esto compilaráraygui.hen librerías estáticas (libraygui.a) tanto para x86 como para x64.
Si hiciste todo correctamente, tendrás un SDK de FreeBASIC completo y listo para usar, tanto para x64 como para x86. Puedes ver los archivos generados (.bi y .a) en la carpeta sdk_freebasic.
Si deseas utilizar la herramienta de conversión de FreeBASIC manualmente:
# Sintaxis
converter.exe <archivo_entrada.h> <archivo_salida.bi>
# Ejemplos
converter.exe raylib.h raylib.bi
converter.exe raygui.h raygui.bi- WinLibs GCC: https://winlibs.com/
- Raylib Releases: https://github.com/raysan5/raylib/releases
- Raygui Releases: https://github.com/raysan5/raygui/releases