*** DISCLAIMER: The information on these pages is not an official instruction or documentation. No responsibility will be taken. Use at your own risk. ***
Showing posts with label c. Show all posts
Showing posts with label c. Show all posts

Friday, November 8, 2024

What's the difference between TAG_DONE and TAG_END in AmigaOS C code?

There is none - it's one and the same.

TAG_DONE and TAG_END are defined as identical clones in NDK2.0:

NDK2.0-4/include/utility/tagitem.h

#define TAG_DONE   (0L) /* terminates array of TagItems. ti_Data unused */
#define TAG_END TAG_DONE

NDK3.1 (and higher) has a slightly different definition of TAG_END, but it's still identical:

Includes\&Libs/include_h/utility/tagitem.h

#define TAG_DONE (0L) /* terminates array of TagItems. ti_Data unused */
#define TAG_END (0L) /* synonym for TAG_DONE */

Tuesday, August 15, 2017

why does vbcc's printf()/snprintf()... not respect %f in format strings?

Problem:
using printf("%f", 1.2);
prints
   %f
instead of
   1.20000

Possible reasons:
no math lib included

Possible solutions:
- add -lmieee or -lmsoft (or other math library -> see vbcc manual) to list of compiler options
- put -lmieee (or whatever math lib you're using) before -lvc in list of compiler libs options

Friday, July 28, 2017

how to create a linker library with vbcc for vbcc

1. compile individual .c source code files for your desired linker library into .o object files, for example:

> path/to/linkerlib
> vc -c libfunc1.c 
> vc -c libfunc2.c

will create "libfunc1.o" and "libfunc2.o"


2. use .o files as required when compiling your code, for example:

> path/to/my_program
> vc path/to/linkerlib/libfunc1.o path/to/linkerlib/libfunc2.o -o my_program my_program.c

or join .o files into one file, which is your new linker library, and use accordingly, for example:

> path/to/linkerlib
> join libfunc1.o libfunc2.o to my.lib
> path/to/my_program
> vc -Lpath/to/linkerlib -lmy -o my_program my_program.c

Thursday, July 20, 2017

libgen.h missing / undefined reference to basename() and/or dirname()

Possible reasons:
- libgen.h missing
- functions basename() and/or dirname() not available


Solution:
- drop/remove #include <libgen.h>
- implement functions basename() and/or dirname()
https://linux.die.net/man/3/dirname

or

- get latest ADE (GG/geekgadgets) from AmiNet
http://aminet.net/package/dev/gcc/ADE