a library that uses shared resources
This commit is contained in:
parent
22d9ae409b
commit
3b3b5d2839
7 changed files with 83 additions and 0 deletions
31
tests/multishared/Makefile
Normal file
31
tests/multishared/Makefile
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
# Makefile to build class 'multishared' for Pure Data.
|
||||||
|
# Needs Makefile.pdlibbuilder as helper makefile for platform-dependent build
|
||||||
|
# settings and rules.
|
||||||
|
|
||||||
|
# library name
|
||||||
|
lib.name = multishared
|
||||||
|
|
||||||
|
# common functions
|
||||||
|
shared.sources = shared.c
|
||||||
|
|
||||||
|
# input source file (class name == source file basename)
|
||||||
|
class.sources = multisharedA.c multisharedB.c
|
||||||
|
|
||||||
|
# all extra files to be included in binary distribution of the library
|
||||||
|
datafiles = multishared-help.pd multishared-meta.pd
|
||||||
|
|
||||||
|
# include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder'
|
||||||
|
PDLIBBUILDER_DIR=../..
|
||||||
|
include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder
|
||||||
|
|
||||||
|
# simplistic tests whether all expected files have been produced/installed
|
||||||
|
buildcheck: all
|
||||||
|
test -e lib$(lib.name).$(shared.extension)
|
||||||
|
test -e multisharedA.$(extension)
|
||||||
|
test -e multisharedB.$(extension)
|
||||||
|
installcheck: install
|
||||||
|
test -e $(installpath)/lib$(lib.name).$(shared.extension)
|
||||||
|
test -e $(installpath)/multisharedA.$(extension)
|
||||||
|
test -e $(installpath)/multisharedB.$(extension)
|
||||||
|
test -e $(installpath)/multishared-help.pd
|
||||||
|
test -e $(installpath)/multishared-meta.pd
|
||||||
7
tests/multishared/multishared-help.pd
Normal file
7
tests/multishared/multishared-help.pd
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
#N canvas 335 160 450 300 12;
|
||||||
|
#X msg 143 93 7;
|
||||||
|
#X obj 143 125 multisharedA;
|
||||||
|
#X obj 223 125 multisharedB;
|
||||||
|
#X msg 223 93 12;
|
||||||
|
#X connect 0 0 1 0;
|
||||||
|
#X connect 3 0 2 0;
|
||||||
9
tests/multishared/multishared-meta.pd
Normal file
9
tests/multishared/multishared-meta.pd
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
#N canvas 966 322 200 200 10;
|
||||||
|
#N canvas 19 51 420 300 META 0;
|
||||||
|
#X text 10 10 META this is a prototype of a libdir meta file;
|
||||||
|
#X text 10 51 AUTHOR IOhannes m zmolnig;
|
||||||
|
#X text 10 110 VERSION 1.0.0;
|
||||||
|
#X text 10 90 LICENSE CC0;
|
||||||
|
#X text 10 70 DESCRIPTION Example "multishared" external.;
|
||||||
|
#X text 10 30 NAME multishared;
|
||||||
|
#X restore 10 10 pd META;
|
||||||
3
tests/multishared/multishared.h
Normal file
3
tests/multishared/multishared.h
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
#include <m_pd.h>
|
||||||
|
|
||||||
|
void multishared_foo(t_float f);
|
||||||
14
tests/multishared/multisharedA.c
Normal file
14
tests/multishared/multisharedA.c
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
#include "multishared.h"
|
||||||
|
t_class*multisharedA_class;
|
||||||
|
static void multisharedA_float(t_object*x, t_float f1) {
|
||||||
|
pd_error(x, "%s got %f", __FUNCTION__, f1);
|
||||||
|
multishared_foo(f1);
|
||||||
|
}
|
||||||
|
static void*multisharedA_new(void) {
|
||||||
|
return pd_new(multisharedA_class);
|
||||||
|
}
|
||||||
|
void multisharedA_setup(void) {
|
||||||
|
post("%s", __FUNCTION__);
|
||||||
|
multisharedA_class = class_new(gensym("multisharedA"), multisharedA_new, 0, sizeof(t_object), 0, A_NULL);
|
||||||
|
class_addfloat(multisharedA_class, multisharedA_float);
|
||||||
|
}
|
||||||
14
tests/multishared/multisharedB.c
Normal file
14
tests/multishared/multisharedB.c
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
#include "multishared.h"
|
||||||
|
t_class*multisharedB_class;
|
||||||
|
static void multisharedB_float(t_object*x, t_float f1) {
|
||||||
|
pd_error(x, "%s got %f", __FUNCTION__, f1);
|
||||||
|
multishared_foo(f1);
|
||||||
|
}
|
||||||
|
static void*multisharedB_new(void) {
|
||||||
|
return pd_new(multisharedB_class);
|
||||||
|
}
|
||||||
|
void multisharedB_setup(void) {
|
||||||
|
post("%s", __FUNCTION__);
|
||||||
|
multisharedB_class = class_new(gensym("multisharedB"), multisharedB_new, 0, sizeof(t_object), 0, A_NULL);
|
||||||
|
class_addfloat(multisharedB_class, multisharedB_float);
|
||||||
|
}
|
||||||
5
tests/multishared/shared.c
Normal file
5
tests/multishared/shared.c
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
#include "multishared.h"
|
||||||
|
|
||||||
|
void multishared_foo(t_float f) {
|
||||||
|
post("%s(%f)", __FUNCTION__, f);
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue