View Single Post
Old 03 January 2014, 20:23   #44
FS-UAE Developer

FrodeSolheim's Avatar
Join Date: Dec 2011
Location: Førde, Norway
Age: 37
Posts: 3,427
uaenative.library implementation is more or less complete now, with async mode too - I have also created a simple script which takes a native library and generates wrapper functions for ease of use. Here's how usage looks now:

Example native library:

#include "uni_library.h"
#include <stdio.h>


UNIAPI void UNICALL hello_world (struct uni *uni)
    uni_char *data = UNI_PCHAR_PARAM (d1);
    uni_long data_len = UNI_LONG_PARAM (d2);
    snprintf (data, data_len, "Hello World!\n\nBest regards, %s",
Example Amiga program using the auto-generated wrapper functions (wrapper name "hwlib" chosen when generating the wrappers - tested using GCC 2.95.3 cross-compiler for m68k-amigaos):

#include "hwlib.h"

static char data[128];

int main (int argc, char *argv[])
    if (!hwlib_open ()) {
        printf ("error opening hwlib: %lx\n", hwlib_get_last_error ());
        return 1;
    hwlib_hello_world (data, 128);
    printf ("%s\n", data);
    hwlib_close ();
    return 0;
The advantage of using the wrapper functions, besides ease of use, is that you also get parameter checking due to having proper C function prototypes, and the arguments are sent through the correct registers automatically

(You can of course just use uaenative.library directly, more or less like the old native interface - except you perform library jumps instead of an absolute jump).

Last edited by FrodeSolheim; 05 January 2014 at 11:09.
FrodeSolheim is offline  
Page generated in 0.04097 seconds with 10 queries