Paolo Redaelli | 12 Aug 09:38
Favicon

Wrapping unions

Are unions accessible like structures using externals?
For example:

#include <stdlib.h>

union unione {
	int intero;
	void *puntatore;
};

union unione *get_unione () {
	return (union unione *) malloc(sizeof(union unione));
};

could be accessed with?

	intero (ptr: POINTER): INTEGER is
		external "[
			C union unione get intero use "unione.h"
			]"
		end

	puntatore (ptr: POINTER): POINTER is
		external "[
			C union unione get puntatore use "unione.h"
			]"
		end

As far as I can say it is not possible. 
I know that I circumvent the problem writing come C macros or inline
(Continue reading)


Gmane