33 lines
453 B
Plaintext
33 lines
453 B
Plaintext
#include "EXTERN.h"
|
|
#include "perl.h"
|
|
#include "XSUB.h"
|
|
#include <string.h>
|
|
|
|
typedef struct {
|
|
int x;
|
|
int y;
|
|
} Point;
|
|
|
|
static int
|
|
_add(int a, int b) {
|
|
return a + b;
|
|
}
|
|
|
|
static double
|
|
compute_distance(int x1, int y1, int x2, int y2) {
|
|
int dx = x2 - x1;
|
|
int dy = y2 - y1;
|
|
return _add(dx * dx, dy * dy);
|
|
}
|
|
|
|
MODULE = MyModule PACKAGE = MyModule
|
|
|
|
int
|
|
add(a, b)
|
|
int a
|
|
int b
|
|
CODE:
|
|
RETVAL = _add(a, b);
|
|
OUTPUT:
|
|
RETVAL
|