Open DMX external?
hi there
i followed the different forum post on getting the enttec open dmx usb to work in ubuntu and pd.
so far i downloaded the dmx4linux-2.6 package
extracting it ok
patching it ok
./configure ok
make gives me this result:
make -C libs all
make[1]: Betrete Verzeichnis '/home/maik/externals/dmx4linux-2.6.1/libs'
cc -c -o open.o open.c
cc -c -o sleep.o sleep.c
ar rcs libdmx4l.a open.o sleep.o
cc -fPIC -c -o open.lo open.c
cc -fPIC -c -o sleep.lo sleep.c
cc -shared -Wl,-soname,libdmx4l.so.2 -o libdmx4l.so.2.5 open.lo sleep.lo -lc
ln -sf libdmx4l.so.2.5 libdmx4l.so.2
ln -sf libdmx4l.so.2 libdmx4l.so
make[1]: Verlasse Verzeichnis '/home/maik/externals/dmx4linux-2.6.1/libs'
make -C tools all
make[1]: Betrete Verzeichnis '/home/maik/externals/dmx4linux-2.6.1/tools'
cc -Ipointer -Wall -O2 -I/home/maik/externals/dmx4linux-2.6.1/include -c -o dmxtest.o dmxtest.c
dmxtest.c: In Funktion »Reader«:
dmxtest.c:65: Warnung: Der Rückgabewert von »fgets«, der mit dem Attribut warn_unused_result deklariert wurde, wird ignoriert
dmxtest.c: In Funktion »Writer«:
dmxtest.c:143: Warnung: Der Rückgabewert von »fgets«, der mit dem Attribut warn_unused_result deklariert wurde, wird ignoriert
cc -L/home/maik/externals/dmx4linux-2.6.1/libs -o dmxtest dmxtest.o -ldmx4l
cc -Ipointer -Wall -O2 -I/home/maik/externals/dmx4linux-2.6.1/include -c -o midi2dmx.o midi2dmx.c
midi2dmx.c: In Funktion »DMXput«:
midi2dmx.c:246: Warnung: Der Rückgabewert von »write«, der mit dem Attribut warn_unused_result deklariert wurde, wird ignoriert
midi2dmx.c:254: Warnung: Der Rückgabewert von »write«, der mit dem Attribut warn_unused_result deklariert wurde, wird ignoriert
midi2dmx.c: In Funktion »reset«:
midi2dmx.c:297: Warnung: Der Rückgabewert von »write«, der mit dem Attribut warn_unused_result deklariert wurde, wird ignoriert
cc -L/home/maik/externals/dmx4linux-2.6.1/libs -o midi2dmx midi2dmx.o -ldmx4l
cc -Ipointer -Wall -O2 -I/home/maik/externals/dmx4linux-2.6.1/include -c -o uart_dmxd.o uart_dmxd.c
cc -L/home/maik/externals/dmx4linux-2.6.1/libs -o uart_dmxd uart_dmxd.o -ldmx4l
cc -Ipointer -Wall -O2 -I/home/maik/externals/dmx4linux-2.6.1/include -c -o dmxconsole.o dmxconsole.c
dmxconsole.c:19:20: Fehler: curses.h: No such file or directory
dmxconsole.c: In Funktion »mask«:
dmxconsole.c:138: Warnung: Implizite Deklaration der Funktion »erase«
dmxconsole.c:141: Warnung: Implizite Deklaration der Funktion »attrset«
dmxconsole.c:142: Warnung: Implizite Deklaration der Funktion »move«
dmxconsole.c:143: Fehler: »COLS« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:143: Fehler: (Jeder nicht deklarierte Bezeichner wird nur einmal aufgeführt
dmxconsole.c:143: Fehler: für jede Funktion in der er auftritt.)
dmxconsole.c:144: Warnung: Implizite Deklaration der Funktion »addch«
dmxconsole.c:148: Fehler: »LINES« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:161: Warnung: Implizite Deklaration der Funktion »printw«
dmxconsole.c: In Funktion »values«:
dmxconsole.c:199: Fehler: »COLS« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:207: Warnung: Implizite Deklaration der Funktion »mvprintw«
dmxconsole.c:249: Fehler: »LINES« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:263: Warnung: Implizite Deklaration der Funktion »attron«
dmxconsole.c:263: Fehler: »A_REVERSE« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:268: Warnung: Implizite Deklaration der Funktion »addstr«
dmxconsole.c: In Funktion »crossfade«:
dmxconsole.c:362: Warnung: Implizite Deklaration der Funktion »refresh«
dmxconsole.c: In Funktion »load«:
dmxconsole.c:404: Warnung: Der Rückgabewert von »fread«, der mit dem Attribut warn_unused_result deklariert wurde, wird ignoriert
dmxconsole.c: In Funktion »changepalette«:
dmxconsole.c:470: Warnung: Implizite Deklaration der Funktion »init_pair«
dmxconsole.c:470: Fehler: »COLOR_BLACK« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:470: Fehler: »COLOR_CYAN« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:471: Fehler: »COLOR_GREEN« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:472: Fehler: »COLOR_WHITE« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:473: Fehler: »COLOR_BLUE« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:474: Fehler: »COLOR_RED« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:476: Fehler: »COLOR_YELLOW« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:492: Warnung: Implizite Deklaration der Funktion »COLOR_PAIR«
dmxconsole.c:503: Fehler: »A_REVERSE« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:504: Fehler: »A_BOLD« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:505: Fehler: »A_NORMAL« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c: In Funktion »calcscreengeometry«:
dmxconsole.c:536: Fehler: »COLS« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:543: Fehler: »LINES« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c: Auf höchster Ebene:
dmxconsole.c:566: Fehler: expected »=«, »,«, »;«, »asm« or »__attribute__« before »*« token
dmxconsole.c: In Funktion »pointerevent«:
dmxconsole.c:613: Fehler: »KEY_UP« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:616: Fehler: »KEY_DOWN« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:620: Fehler: »KEY_LEFT« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:623: Fehler: »KEY_RIGHT« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:627: Fehler: »KEY_PPAGE« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:630: Fehler: »KEY_NPAGE« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c: Auf höchster Ebene:
dmxconsole.c:636: Fehler: expected »)« before »a«
dmxconsole.c: In Funktion »cleanup«:
dmxconsole.c:648: Fehler: »w« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:650: Warnung: Implizite Deklaration der Funktion »resetty«
dmxconsole.c:651: Warnung: Implizite Deklaration der Funktion »endwin«
dmxconsole.c: In Funktion »main«:
dmxconsole.c:793: Fehler: »w« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:793: Warnung: Implizite Deklaration der Funktion »initscr«
dmxconsole.c:800: Warnung: Implizite Deklaration der Funktion »savetty«
dmxconsole.c:801: Warnung: Implizite Deklaration der Funktion »start_color«
dmxconsole.c:802: Warnung: Implizite Deklaration der Funktion »noecho«
dmxconsole.c:803: Warnung: Implizite Deklaration der Funktion »raw«
dmxconsole.c:804: Warnung: Implizite Deklaration der Funktion »keypad«
dmxconsole.c:804: Fehler: »TRUE« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:811: Fehler: »mmask_t« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:811: Fehler: expected »;« before »m«
dmxconsole.c:812: Warnung: Implizite Deklaration der Funktion »mousemask«
dmxconsole.c:812: Fehler: »BUTTON1_PRESSED« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:812: Fehler: »BUTTON2_PRESSED« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:812: Fehler: »BUTTON3_PRESSED« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:812: Fehler: »BUTTON4_PRESSED« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:812: Fehler: »REPORT_MOUSE_POSITION« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:812: Fehler: »m« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:813: Warnung: Implizite Deklaration der Funktion »mouseinterval«
dmxconsole.c:855: Warnung: Implizite Deklaration der Funktion »wgetch«
dmxconsole.c:961: Fehler: »KEY_PPAGE« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:979: Fehler: »KEY_NPAGE« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:1012: Fehler: »KEY_HOME« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:1018: Fehler: »KEY_END« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:1026: Fehler: »KEY_RIGHT« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:1031: Fehler: »KEY_LEFT« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:1036: Fehler: »KEY_DOWN« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:1047: Fehler: »KEY_UP« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:1059: Fehler: »KEY_IC« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:1066: Fehler: »KEY_DC« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:1129: Warnung: Implizite Deklaration der Funktion »KEY_F«
dmxconsole.c:1129: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
dmxconsole.c:1133: Fehler: case-Marke reduziert nicht auf Ganzzahlkonstante
dmxconsole.c:1137: Fehler: »KEY_MOUSE« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:1139: Fehler: expected »=«, »,«, »;«, »asm« or »__attribute__« before »oldevent«
dmxconsole.c:1139: Fehler: »oldevent« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:1140: Fehler: »MEVENT« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:1140: Fehler: expected »;« before »event«
dmxconsole.c:1141: Warnung: Implizite Deklaration der Funktion »getmouse«
dmxconsole.c:1141: Fehler: »event« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:1141: Fehler: »OK« nicht deklariert (erste Benutzung in dieser Funktion)
dmxconsole.c:1141: Warnung: Implizite Deklaration der Funktion »meventcmp«
dmxconsole.c:1184: Warnung: Implizite Deklaration der Funktion »resizeterm«
make[1]: *** [dmxconsole.o] Fehler 1
make[1]: Verlasse Verzeichnis '/home/maik/externals/dmx4linux-2.6.1/tools'
make: *** [all] Fehler 2
any suggestions? something with dmxconsole?
i'm really not into all the programming stuff so i basically need everything step by step.
hope someone can help
greets uisel
Compiling externals on OSX
this is the simplest way to compile externals on osx 10.5 and pd-0.41-4
(really rude method)
-
install Xcode
-
write your external.c or find one already done
-
open finder -> applications -> pd-package. open package.
Then go to Resources -> extra.
there are some built in externals folders
-make a copy of one of these folders and rename the same as your external.
-inside this folder delete all the files except the makefile and copy your external.c there.
-open the makefile and rewrite the fields NAME and CSYM with the name of your external (if sou wrote a tilde external -> see one of the built in as fiddle~)
Save -
ok, now come back to "extra" folder, open makefile and change at first row "pd_linux" with "d_fat"
Save -
open terminal and type:
cd /Applications/Pd-0.41-4.app/Contents/Resources/extra/your-external
make -
copy the external in "extra" folder or where it needs
it's done.
Using arrays and signals in a same external
@obiwannabe said:
Laurent, if C++ is your preferred language and you want a flex_ible t_emplate for externals that incorporates a bit of cross platform forethought then hava a look at Flext.
Hi Obiwannabe,
In fact I do not have really a preference between both langages, as I used both in my current projects, even if I have seen and made more C code, for the moment.
I am most "fluent" to develop with either matlab or scilab, either max/msp or pure data, but, now, to go from prototypes to powerfull and easier to distribute and use applications, I have been considering working with either C (DSP processing) or C++ (rather easier to build a GUI, according to my capabilities and available time) as I want to deliver cross platform applications: Objective-C is smart with Apple Developpers Tools but I am not sure it is really easy to perform cross platform applications with it.
As I mainly develop prototypes and physical models, play with ugly sets of equations, I do not have a great experience with these three languages. It may change in the following months.
And, as I need to succeed in finishing an external by sunday evening for a potential real time demonstration on monday 05/19 mrining, I have taken the first way to develop externals I found and thought I may be able to manage within less 2 weeks, a week ago!
Yet, I am going to have a quick look at Flext, today if possible, in order to determine if it is easier for me to perform the job by sunday using it rather than using C-coded externals.
My constraints are to be able to:
-receive two arrays, one sample, one circular buffer index as inputs;
- perform a simple addition between both arrays, one being multiplied by the input sample value, using a cricular buffer for the second one array;
- send the current sample output, the updated circula buffer array and an updated version of its index as output;
- make the whole external work for samples given by a 44.1 kHz and 16-bit wavefile, in real time!
I also need to be able to develop, at least another external, to change one of the arrays, in perceptive real time, to use it as input ( the first array, not the circular buffer) of the first external. And, being able to plot the modified array to show what it looks like could a nice improvement.
This array would be a caricatural time-varying impulse response, maybe, with changes related to the positions of the source and the receiver (within a time-varying ?) shoe-box room, taking into account several orders of reflexion.
I may know how to make the inner C code for DSP processing, I "just" need to encapsulate them in a pd external, enough efficient to present a temporal convolution algorithm without FFT, working yet in real time without (perceptible) latency with as long as possible "impulse reponses" (around 350 ms I guess or hope for the first version).
So, here are the rules, I "just" have to use the right external coding tool as I must have finished by the end of this week...
And, I will distribute the externals and their related code as soon as I will have time to write a good documentation, above all for the English version, which is not my native tongue, as you may have noticed 8;O).
Sincerly yours,
Laurent Millot
Problem compiling external on Windows
Great tutorial, very detailed!
Thanks for this addition..
Sorry for coming later on this subject but I'll try to add few lines about
compiling externals in Win without going through MSVC Express
edition (by the way: what are the limitations of the express edition
w.r.t. the full package?).
Even if MSVC offers an integrated environment for developing there
can be some good reasons for giving a try to the old-man "unix" way of
compiling, which in windows is best represented by MINGW32 and
cygwin. Both offers linux-like environments (i.e. command line tools)
for compiling and other shell tasks which, sometimes, in windows are
a pain in the ass.
There are at least three good reasons for giving a look at mingw:
- gives strong linux compatibility on external compilation
(almost same command lines arguments etc.) - there is the possibility to use makefiles in an almost straightforward way
(with minor modifications to linux makefiles). - no dependency on expensive MS programs (except for the
small, bug-free Operating System
I did this exercise by porting the E. Lyon "LyonPoutpourry" externals for win
(http://www.sarc.qub.ac.uk/~elyon/LyonSoftware/Pd/). Give a look at
the win source package: inside there is a makefile for darwin (MAC)
linux and win. I added the latter, and as you can see the modifications
are minor.
----------- 1. Prelude: compilation environment ------------------
First of all we have to set once for all the compilation environment.
Let's forget for the moment cygwin and concentrate on mingw32 (http://www.mingw.org/). The following is taken from (H.C. Steiner's wiki http://www.puredata.org/docs/developer/mingw)
Download the MinGW package installer and run it:
(http://prdownloads.sourceforge.net/mingw/MinGW-5.1.1.exe)
Choose the Candidate distribution. Install the defaults and add the g++ compiler, g77 compiler, and MinGW make or you can just download my MinGW install, MinGW-Pd.tar.bz2, and uncompress it so that its installed into C:\MinGW.
Then we need MSYS which is a shell (an interpreter of the commands, like a
colorful dos prompt 
http://prdownloads.sourceforge.net/mingw/MSYS-1.0.10.exe
Now you will be using the MSYS shell that was installed from the MSYS installer. You can launch it from the Desktop shortcut or Start -> Programs -> MinGW -> MSYS -> msys
----------- 2. Allegro: compilation trial ------------------
a. open MSYS
b. at the prompt type:
cd c:
(or the drive you whish to go for the pd external compilation)
c. go to the external directory (note the backslashes instead of slashes !),
mine is external-compiling. Inside I have helloworld.c
cd alberto/backup/PureData_Archive/patches/AlbertoZ/external-compiling/
d. copy m_pd.h (from the PD distribution directory) into external-compiling
(or whatever is its name)
e. type:
gcc -c helloworld.c -o helloworld.o
f. type:
ld -export_dynamic -shared -o helloworld.dll helloworld.o c:/Programmi/pd039e
xt4/bin/pd.dll
(this is the linker step. note that I linked to a particular version of pd.dll - 0.39 extended test 4, so probably (I'm not sure about this) the external will
run on 0.39 only. Can someone confrm this?)
g. If everything was ok then you should have a helloworld.dll in your
directory. Move it on the extra folder of your pd distribution
(I assume that extra folder is in the pd predefined path) and make a
new patch with the helloworld object. Again, if everything is correct,
you should have a "Hello world!!" printed on the console.
----------- 3. Adagio: makefile ------------------
A makefile can be used for compilation. Even if a simple helloworld
application does not need it, complex programs may do.
The makefile.win is attached with this post. Modify it according to your
path in
Make sure you have
helloworld.c
m_pd.h
makefile.win
in your directory. Now type at MSYS prompt:
make -f makefile.win
This will automatically produce:
the object, the linker step (the dll) and will copy the helloworld.dll
in the extra folder of you pd distribution (overwriting the existing one
.
----------- 4. Allegro con brio: conclusions ------------------
Why not give a try to the old-man compilation on Win?

----------- 5. Minuetto: greetings ------------------
I apologize if I said some crap somewhere, just let me know if it
doesn't work. Have fun!
Best regards,
Alberto
Problem compiling external on Windows
Hey,
thanks to everyone who responded to my posts both here and in the mailing list. Since then, I've figured out how to compile externals written in C using Microsoft Visual C++ 2005. There's more to document, however, such as how to compile externals using some of the other Windows compilers (Borland, djgpp, etc.), and also how to compile externals written in C++ in Windows. But one thing at a time.
one little thing to note... steps 4 and 7 may seem a little roundabout, but they account for the fact that MSVC sometimes has trouble with spaces in directory names (eg. C://Program Files/). If anyone knows how to override this behavior, post a reply, and I'll try to simplify the steps accordingly.
Updated June 29, 2007:
use [b]C://Progra~1/[/b] instead of [b]C://Program Files/[/b],
use [b]C://Docume~1/[/b] instead of [b]C://Documents and Settings/[/b], etc.
So, without further ado...
How to compile a pd external written in C using Microsoft Visual C++ 2005:
Compared to Windows, linux offers a much more user-friendly environment for compiling pd externals. However, with a little patience, a usable environment can be set up in Windows, and the good news is that everything you need is available for free. There are several reputable Windows-compatible C/C++ compilers out there, but here I'll discuss compiling externals with Microsoft Visual C++ 2005 (MSVC for short).
1. Download and Install Microsoft Visual C++ 2005 Express Edition.
a. Click the link above, then click Go! in the Visual C++ box.
b. Run vcsetup.exe to install the program
(the setup wizard should guide you through the process).
2. Download [url=http://download.microsoft.com/download/7/7/3/7737290f-98e8-45bf-9075-85cc6ae34bf1/VS80sp1-KB9267
]Visual C++ 2005 Express Service Pack 1.
a. Click the link above to download the Service Pack.
b. Run VS80sp1-KB926748-X86-INTL.exe to install the program.
3. Create a new project:
a. Open Visual C++.
b. Open the New Project window (Ctrl+Shift+N).
c. In the Project Types pane, select Visual C++.
d. In the Templates pane, select emptyproj.
e. Enter object name (helloworld).
f. Leave Create directory for solution unchecked, and click OK.
4. Import the pd header file:
a. Get m_pd.h here, or, using pd-vanilla (not pd-extended):
1. Open Windows Explorer or My Computer.
2. Navigate to the pd/src/ directory on your system.
3. Open m_pd.h in a text editor (file type is: C/C++ header).
b. Select all (Ctrl+A).
c. Copy selection to the clipboard (Ctrl+C).
d. Back in Visual C++, open the New File window (Ctrl+N).
e. In the Categories pane, select General.
f. In the Templates pane, select Text File, and click Open.
g. Copy the contents of m_pd.h into the editor window (Ctrl+V).
h. Open the Save File As Window (Ctrl+S).
i. Save as m_pd.h.
j. From the File Menu, select Move m_pd.h into; select helloworld.
5. Write the source code for the external in C.
a. Open the New File window (Ctrl+N).
b. In the Categories pane, select General.
c. In the Templates pane, select Text File, and click Open.
d. Write your source code in the editor window.
The following example is taken from the tutorial by Johannes M. Zmoelnig.
#include "m_pd.h"
static t_class *helloworld_class;
typedef struct _helloworld {
t_object x_obj;
} t_helloworld;
void helloworld_bang(t_helloworld *x)
{
post("Hello world !!");
}
void *helloworld_new(void)
{
t_helloworld *x = (t_helloworld *)pd_new(helloworld_class);
return (void *)x;
}
void helloworld_setup(void) {
helloworld_class = class_new(gensym("helloworld"),
(t_newmethod)helloworld_new,
0, sizeof(t_helloworld),
CLASS_DEFAULT, 0);
class_addbang(helloworld_class, helloworld_bang);
}
6. Save and import the source code into the project:
a. Open the Save File As Window (Ctrl+S).
b. Save as helloworld.c.
c. From the File Menu, select Move helloworld.c into; select helloworld.
7. Access the pd library file:
a. Open Windows Explorer or My Computer.
b. Navigate to the pd/bin/ directory on your system.
c. Right-click on pd.lib (file type is: Object File Library) and select Copy.
d. Navigate to the C://TEMP/ directory on your system.
e. Paste the copy of pd.lib in the C://TEMP/ directory (right-click or Ctrl-V).
8. Set configuration properties:
a. Set configuration type to .dll:
1. Back in Visual C++, open the helloworld Property Pages window (Alt+F7).
2. In the left pane, select Configuration Properties >> General.
3. In the right pane, under Project Defaults, click on
Configuration Type, and select Dynamic Library (.dll)
(using the arrow on the right).
b. Add MSW to preprocessor definitions:
1. In the left pane, select
Configuration Properties >> C/C++ >> Preprocessor.
2. In the right pane, type MSW in the Preprocessor Definitions field.
c. Tell compiler which language to use:
1. In the left pane, select
Configuration Properties >> C/C++ >> Advanced.
2. In the right pane, select Compile As.
3. Select Compile as C Code (/TC) by clicking the arrow on the right.
d. Tell linker where to find pd.lib:
1. In the left pane, select Configuration Properties >> Linker >> Input.
2. In the right pane, select Additional Dependencies and enter
C://TEMP/pd.lib.
e. Tell linker to export the setup function:
1. In the left pane, select
Configuration Properties >> Linker >> Command Line.
2. In the right pane, type
/export:helloworld_setup in the Additional options field.
3. Click OK.
9. Compile and link:
a. Use the Build Solution command (F7).
10. Copy the new helloworld.dll file into pd.
a. Open Windows Explorer or My Computer.
b. Navigate to the
My Documents/Visual Studio 2005/Projects/helloworld/Debug/
directory on your system.
c. Right-click on helloworld.dll (file type is: Application Extension)
and select Copy.
d. Navigate to the pd/extra directory on your system.
e. Paste the copy of helloworld.dll in the pd/extra directory
(right-click or Ctrl-V).
11. Test the external in pd.
a. the external should now be a useable object in pd.
b. open a new pd patch and try to create a helloworld object.
c. add a bang to the left inlet and test it out.
d. if the main pd console window displays "Hello world !!",
the external has succeeded.
Hope this helps!
-- middlepedal
Problem compiling external on Windows
This has been answered on pd-list today
Hopefully this is helpful to others. I never go near Windows myself,
but anyway, post copied verbatim for the benefit of all...
> Iohannes Zmoelnig wrote:
> have you tried any online resources: e.g.
> http://puredata.info/docs/developer lists at least 2 pages that only
> deal with compiling on windows
> (http://puredata.info/docs/developer/mingw which basically deals with
> compiling pd itself on windows; but once you are there, it is simple;
> http://nul.jp/2002/pd_bc deals with compiling externals with the
> borland-compiler).
> i can give you a step-by-step guide for compiling zexy though (but mind
> that this is how i _remember_ it; i will not go and search for a windows
> machine with VC installed just to verify each step).
> - purchase M$ VC6 (elitarism on my side...:-)) and install it
> - get pd
> - download zexy (sources!) for free (e.g.
> ftp://ftp.iem.at/pub/pd/Externals/ZEXY/)
> - extract zexy to you favourite folder
> - double-click on the zexy.dsp (or was it zexy.dsw??) in the zexy/src/
> folder; this should open VC
> - to to the Project->Properties (or however this is called in your
> locale) and change the settings to match your setup (mainly these are
> the paths to find pd's headers and libraries; you should basically go
> through every item in the settings for the "release" and/or "debug"
> builds; the most important stuff is in "compiler->preprocessor",
> "compiler->path" and "linker->path"
> - when you are finished, return to the main project window
> - hit "F7" to start the build.
> - if you encounter any errors, either the settings are not yet correct
> (return to item-6) or the project is a bit out-of-date; the latter
> basically means, that the c-files to be included have not been updated;
> to fix this, just delete all the c-files from the project file browser
> (here this used to be un the left-side of the project-window), then
> right click on the folder in the project file browser that used to
> contain these files and select "add"; in the openpanel choose all
> c-files in zexy/src and hit "OK"
> - return to item-8 until you stop getting errors
> mind, that you must not use the dll while it is created (best close pd)
> if you want step-by-step instructions for vc7, vc2000, vc2006 and
> vc3000, please send them to me and i'll give it a go
(dev-elitarism
> again)
> pd comes with some externals (e.g. the foo-stuff, or [fiddle~]) and uses
> makefiles to build these.
> for this to work, you have to setup your environment correctly:
-> first open the makefile (e.g. pd/doc/6.externs/makefile) with your
> favourite text-editor and correct all the paths that are wrong
> - VC6 came with a vc6vars.bat (ok the name is wrong but something along
> these lines; it was a .bat-file which would set your envirnment
> variables when run; more modern incarnations might do without the .bat
> - open the dosbox (the rest will happen within the dosbox)
> - run the vc6vars.bat (or however it is called) if this is needed for
> your compiler-incarnation
> - cd to your path (e.g. pd/doc/6.externs/)
> - run "nmake pd_nt"
> if nmake, cl, link cannot be found, you might want to add the paths to
> them to your PATH variable.
Martin Peach wrote:
> If you're on some kind of MSVC, you set up a project to build a dll, in
> "preprocessor defines" define MSW, in "additional include paths" include
> the path to pd/src/m_pd.h, link with pd.lib from pd/bin, and in the
> linker command line add "/export:yourexternal_setup" to export the setup
> function. All the other functions in your code can be static and don't
> need to be exported. After it builds you take the dll from the release
> folder and put it in your pd/extra folder.
> That should be everything you need, but if it's too cryptic I can go
> into more detail...
> Martin
Problem compiling external on Windows
I'm having trouble getting the helloworld external to compile properly on Windows.
The main resource is apparently this: HOWTO write an External for puredata, and some previous posts on this topic are here: Compiling new external, Max/MSP microtuning externals to convert to pd
Bear with me, because working with the C compiler is still rather mysterious to me, so I may be making some obvious mistakes. I've installed the djgpp compiler, and followed all the instructions as best as I could. I'm working on XP. I put "m_pd.h" (from the pd/src/ folder) and "helloworld.c" in the same folder and from that directory on the command line (in a DOS "Command Prompt" window) typed:
gcc -c helloworld.c -o helloworld.o
As far as I can tell, this successfully produced the "helloworld.o" object file in the same directory as the "helloworld.c" file. Then I typed:
ld -export_dynamic -shared -o helloworld.dll helloworld.o -lc -lm
Which, as I understand, is the "linking" step, and the only difference between this command and the command for linux is that ".pd_linux" is replaced with ".dll". Anyway, the compiler responded with:
c:/progra~1/djgpp/bin/ld.exe: -shared not supported
So, not having any other ideas, I tried omitting the -shared flag:
ld -export_dynamic -o helloworld.dll helloworld.o -lc -lm
That produced this response:
c:/progra~1/djgpp/bin/ld.exe: warning: cannot find entry symbol xport_dynamic; defaulting to 000018d0
helloworld.o:helloworld.c:(.text+0x1e): undefined reference to `post'
helloworld.o:helloworld.c:(.text+0x37): undefined reference to `pd_new'
helloworld.o:helloworld.c:(.text+0x60): undefined reference to `gensym'
helloworld.o:helloworld.c:(.text+0x79): undefined reference to `class_new'
helloworld.o:helloworld.c:(.text+0x96): undefined reference to `class_addbang'
Why is -shared not supported and what can I do to fix that? I tried Microsoft Visual C++ Express Edition, but found the interface bewildering. I don't think I could even find the words "compile" and "link" in any menu...
Then I looked in the "0.README" file located in the pd/doc/6.externs/ directory, and found this line (in reference to the 3 example enternals in that folder):
To compile, type "make pd_linux", "nmake pd_nt", "make pd_irix5" or "make pd_irix6".
If I wanted to compile these, where would I even type this? Is "nmake" an actual command?
Then I tried poking around the GNU info files, and saw some vague information about "binutils" and "dlltool" but it is so beyond me right now that I'm turning here. Could someone please enumerate the steps required to take the C source file "helloworld.c" and make it into a usable object in pd without skipping any steps? I (and I'm sure many others) would greatly appreciate that.
Thanks in advance!
Pd + linux + vst(i) + slackware-11
Moved a little bit further
cd grill/vst
bash ../flext/built.sh pd gcc PKGINFO=package.txt
It says that OS is not supported, very logical since ./grill/vst/src/main.h writes:
#if FLEXT_OS == FLEXT_OS_WIN || FLEXT_OS == FLEXT_OS_MAC
I added
|| FLEXT_OS == FLEXT_OS_LINUX
so it became
#if FLEXT_OS == FLEXT_OS_WIN || FLEXT_OS == FLEXT_OS_MAC || FLEXT_OS == FLEXT_OS_LINUX
But, some files are missing so...
cp -p build/gnumake-mac-gcc.inc build/gnumake-lnx-gcc.inc
cp -p build/config-mac.def build/config-lnx.def
vi build/config-lnx.def, to add vstsdk2.3 source path.
But HERE I am stuck. My programming skills are at 1% 
I suppose that I have to include a linux header file, but I don't know which one!
I suppose this is the problem (grill/vst/src/vsthost.h):
#if FLEXT_OS == FLEXT_OS_WIN
#include <windows.h>
typedef HWND WHandle;
typedef HMODULE MHandle;
#elif FLEXT_OS == FLEXT_OS_MAC
#include <CoreServices/CoreServices.h>
typedef Handle WHandle;
typedef void *MHandle;
#else
#error Platform not supported!
#endif
C++ library and Pd together
The Pd external object file (as in "object code") needs to have one symbol exported. In C++, if your external is called "foodiddly", you need to have:
extern "C" {
void foodiddly_setup(void);
}
Then you can load your external by creating an object in Pd as usual: [foodiddly]. The rest of the code can be called whatever you like, but must be callable from C (for C++ I think this means it must be a normal function, and not a method).
You might want to look at flext, which is supposed to make writing C++ externals for Pd easier. And of course, read the Pd external howto: http://iem.at/pd/externals-HOWTO/
It's no problem to use C++ libraries, your external just needs to call the right functions in the library, and translate between Pd values and what the library needs.
Need help with PD externals
SUBJECT: Need help with PD externals
Hi,
-
I have written some code in C/C++. I would now like to create a pd external and be able to run my C/C++ code in pd (windows environment). I would like my PD object to have say 3-4 inlets and 2-3 outlets.
Furthermore at least one of the inlets would contain compound data, something like an array of 10-15 floats.
Thus my external would be a bit more complex than the 'very basic one', which has a single float as inlet, & a single float as outlet. -
I work in the windows environment (currently my operating environment has pentium machines with windows operating systems installed on them (windows XP, or windows 2000 Professional).
I am using a the free DevCPP or DevC++ compiler (version 4.9.9.2) the IDE, (which uses the gnu C compiler MinGW at its base). Furthermore, I am using: Pd version 0.38.4-extended-RC8 (windows platform). I wonder if someone has already developed externals in a same (or similar, i.e. Windows) environment.
- If someone has, can you please mail me a simple compilable code that you might have had prepared, and guide me through the exact steps which one must follow to make a pd external.
- I wish to know, if in the Windows/DevCPP compiler environment, whether it is possbile to create a PD external without creating a dll in windows, or is it always necessary to first create a dll, even in the simplest case?
- Last, but not the least, I must mention here that I don't have "a lot" of experience in pd, so I will appreciate if someone could explain things in an easy to understand style.
But in any case, I will ask again, in case I don't understand something.
I hope that should work.
Thanks and regards,
ps:
The following should actually have been posted as a separate thread, but since its related to the topic above, i continue to write it here:
In addition to what I have asked for above, I would also like some feedback on the following...
SUBJECT2: Creating/Compiling PD externals
My previous unsucessful attempts at creating/understanding the PD external:
I had tried to read through, and tried to implement the sample code in the tutorial, named:
"How to write an External for puredata" available at the iem site...
But I am facing a few problems, and here are some specific queries related to that:
A.) While in the windows environment, must one always need to create a dll first, or is it possible to create a PD external in any other way as well?
B.) If one must do it by first creating a dll, then the code as mentioned in the tutorial would need to be modified and can't just be copy+pasted & compiled directly. I.e.
One needs to paste the data declaration part in the header;
ii) Also one must declare all the subroutine (i.e. procedures/methods) names in the header file as well, while their definition or implementation goes in another main file, which must include our earlier created header file; and finally
iii) One must insert a special prefix before all the methods when are required for the dll...
Am I right about the 3 above mentioned points?
Thanks yet again,

