<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Christof,<div class=""><br class=""></div><div class="">Thanks so much for getting back to us (and so quickly).  This is very helpful for Jake.  I told him how quickly the PD community would respond and you did not disappoint.  We’ll continue to work based on your advice and will update when we are further along.</div><div class=""><br class=""></div><div class="">Does anyone know why Jake can’t seem to sign up for the list?</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Rick</div><div class=""><br class=""></div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Aug 15, 2019, at 4:15 PM, Christof Ressi <<a href="mailto:christof.ressi@gmx.at" class="">christof.ressi@gmx.at</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><div style="font-family: Verdana;font-size: 12.0px;" class=""><div class="">
<div class="">Hi Rick,</div>

<div class=""> </div>

<div class="">> Pd crashes every time a bang hits the object, which is what triggers the internal calculations, including reading the text files.</div>

<div class=""> </div>

<div class="">Actually, it should also crash when using the float inlets. The problem is that his object contains a "struct date *mydate;" member which points to nowhere. Accessing this pointer will of course lead to a segfault. It should be a "struct date mydate;" instead.</div>

<div class=""> </div>

<div class="">Also, all the "t_atom mer[3]", "t_atom ven[3]", etc. members are only used in trackingPlanets_bang, so they should be local variables.</div>

<div class=""> </div>

<div class="">
<div class="">Generally, I think he doesn't understand pointers and memory management very well. Take this example:</div>

<div class=""> </div>

<div class="">double* coef1 = malloc(sizeof(double));<br class="">
double* coef2 = malloc(sizeof(double));<br class="">
double* coef3 = malloc(sizeof(double));<br class="">
struct term termi;<br class="">
termi.numTerm = getTermNum(line);<br class="">
readTermCoefs(line, coef1, coef2, coef3);<br class="">
termi.a = *coef1;<br class="">
termi.b = *coef2;<br class="">
termi.c = *coef3;</div>

<div class=""> </div>

<div class="">This should simply read:</div>

<div class=""> </div>

<div class="">struct term termi;<br class="">
termi.numTerm = getTermNum(line);<br class="">
readTermCoefs(line, &termi.a, &termi.b, &termi.c);</div>

<div class=""> </div>

<div class="">Note in his original code, coef1, coef2, coef3 are never freed. In fact, his code is full of those tiny memory leaks.</div>

<div class=""> </div>

<div class="">I don't want to sound too harsh but I think Jacob needs to first learn the basics of the C programming language before attempting to write a Pd external. There are some good books and tutorials with lots of practical exerices. Also, he might want to show his code to a more experienced C programmer (might be a teacher or colleague) to get some feedback.</div>

<div class=""> </div>

<div class="">Also, I highly recommend learning the very basics of a debugger to find out where your program crashes. Assuming he's using GCC, it's enough to start Pd in the debugger, e.g. "gdb --args pd ./mypatch.pd" -> "run", and after the crash type "bt" to get the backtrace.</div>

<div class=""> </div>

<div class="">Best,</div>

<div class=""> </div>

<div class="">Christof</div>

<div class=""> </div>

<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div style="margin:0 0 10px 0;" class=""><b class="">Gesendet:</b> Donnerstag, 15. August 2019 um 22:28 Uhr<br class="">
<b class="">Von:</b> "Rick Snow" <<a href="mailto:ricksnow@gmail.com" class="">ricksnow@gmail.com</a>><br class="">
<b class="">An:</b> <a href="mailto:pd-list@lists.iem.at" class="">pd-list@lists.iem.at</a><br class="">
<b class="">Cc:</b> "Gartenstein, Jacob P" <<a href="mailto:jgartens@tulane.edu" class="">jgartens@tulane.edu</a>><br class="">
<b class="">Betreff:</b> [PD] Student Project Advice</div>

<div name="quoted-content" class="">
<div class="">Hi all,
<div class=""> </div>

<div class="">I have a student trying to sign up to the list and ask a question but he is having some trouble being approved to this list.  I am pasting his question below and will send any responses to him!  Thanks for any advice you might have.  His email address is <a href="mailto:jgartens@tulane.edu" target="_blank" class="">jgartens@tulane.edu</a></div>

<div class=""> </div>

<div class="">
<div id="divRplyFwdMsg" style="font-family: Calibri , Helvetica , sans-serif;font-size: 16.0px;" class=""><font face="Calibri, sans-serif" style="font-size: 11.0pt;" class=""><b class="">From:</b> Gartenstein, Jacob P<br class="">
<b class="">Sent:</b> Wednesday, August 14, 2019 12:50 AM<br class="">
<b class="">To:</b> <a href="mailto:pd-list@lists.iem.at" target="_blank" class="">pd-list@lists.iem.at</a> <<a href="mailto:pd-list@lists.iem.at" target="_blank" class="">pd-list@lists.iem.at</a>><br class="">
<b class="">Subject:</b> Questions about External </font>

<div class=""> </div>
</div>

<div style="font-family: Calibri , Helvetica , sans-serif;font-size: 16.0px;" class="">
<div id="x_divtagdefaultwrapper" style="font-size: 12.0pt;" class="">
<div style="margin-top: 0.0px;margin-bottom: 0.0px;font-family: Calibri , Helvetica , sans-serif , serif , EmojiFont;" class="">Dear Pd Community - </div>

<div style="margin-top: 0.0px;margin-bottom: 0.0px;font-family: Calibri , Helvetica , sans-serif , serif , EmojiFont;" class=""> </div>

<div style="margin-top: 0.0px;margin-bottom: 0.0px;font-family: Calibri , Helvetica , sans-serif , serif , EmojiFont;" class="">I'm trying to create an object, via a pd external, which takes in several parameters, does internal calculations, and outputs several lists of floats.  </div>

<div style="margin-top: 0.0px;margin-bottom: 0.0px;font-family: Calibri , Helvetica , sans-serif , serif , EmojiFont;" class="">Part of the internal calculation process includes reading thousands of lines of equation coefficients from text documents.  These coefficients, along with the input parameters, are necessary to perform the internal calculations.  </div>

<div style="margin-top: 0.0px;margin-bottom: 0.0px;font-family: Calibri , Helvetica , sans-serif , serif , EmojiFont;" class=""> </div>

<div style="margin-top: 0.0px;margin-bottom: 0.0px;font-family: Calibri , Helvetica , sans-serif , serif , EmojiFont;" class="">I've linked the pd external, entitled trackingPlanets, which creates in pd but doesn't perform any of the desired functionality.  Pd crashes every time a bang hits the object, which is what triggers the internal calculations, including reading the text files.  Through the course of some tests, I've discovered that the text file reading functions cause pd to crash. </div>

<div style="margin-top: 0.0px;margin-bottom: 0.0px;font-family: Calibri , Helvetica , sans-serif , serif , EmojiFont;" class=""> </div>

<div style="margin-top: 0.0px;margin-bottom: 0.0px;font-family: Calibri , Helvetica , sans-serif , serif , EmojiFont;" class="">My questions:</div>

<div style="margin-top: 0.0px;margin-bottom: 0.0px;font-family: Calibri , Helvetica , sans-serif , serif , EmojiFont;" class=""> </div>

<div style="margin-top: 0.0px;margin-bottom: 0.0px;font-family: Calibri , Helvetica , sans-serif , serif , EmojiFont;" class=""><span style="font-size: 12.0pt;" class="">Is there some method to internally read data from text files in pd?</span></div>

<div style="margin-top: 0.0px;margin-bottom: 0.0px;font-family: Calibri , Helvetica , sans-serif , serif , EmojiFont;" class=""> </div>

<div style="margin-top: 0.0px;margin-bottom: 0.0px;font-family: Calibri , Helvetica , sans-serif , serif , EmojiFont;" class=""><span style="font-size: 12.0pt;" class="">Are the internal calculations too much and causing pd to crash?</span></div>

<div style="margin-top: 0.0px;margin-bottom: 0.0px;font-family: Calibri , Helvetica , sans-serif , serif , EmojiFont;" class=""> </div>

<div style="margin-top: 0.0px;margin-bottom: 0.0px;font-family: Calibri , Helvetica , sans-serif , serif , EmojiFont;" class=""><span style="font-size: 12.0pt;" class="">Are there more efficient methods of reaching my desired functionality that may help pd run more smoothly?</span></div>

<div style="margin-top: 0.0px;margin-bottom: 0.0px;font-family: Calibri , Helvetica , sans-serif , serif , EmojiFont;" class=""> </div>

<div style="margin-top: 0.0px;margin-bottom: 0.0px;font-family: Calibri , Helvetica , sans-serif , serif , EmojiFont;" class=""><span style="font-size: 12.0pt;" class="">Thanks in advance for the help,</span></div>

<div style="margin-top: 0.0px;margin-bottom: 0.0px;font-family: Calibri , Helvetica , sans-serif , serif , EmojiFont;" class=""> </div>

<div style="margin-top: 0.0px;margin-bottom: 0.0px;font-family: Calibri , Helvetica , sans-serif , serif , EmojiFont;" class=""><span style="font-size: 12.0pt;" class="">Jake Gartenstein </span></div>

<div style="margin-top: 0.0px;margin-bottom: 0.0px;font-family: Calibri , Helvetica , sans-serif , serif , EmojiFont;" class=""> </div>

<div style="margin-top: 0.0px;margin-bottom: 0.0px;font-family: Calibri , Helvetica , sans-serif , serif , EmojiFont;" class="">Materials:</div>

<div style="margin-top: 0.0px;margin-bottom: 0.0px;font-family: Calibri , Helvetica , sans-serif , serif , EmojiFont;" class=""><a class="x_x_OWAAutoLink" href="https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fdrive%2Ffolders%2F1KYB9GyP31I9tGfwFnY7ctfUH24qvClXa%3Fusp%3Dsharing&data=02%7C01%7Crsnow%40tulane.edu%7C27f33351311e468b113508d721beaad3%7C9de9818325d94b139fc34de5489c1f3b%7C0%7C0%7C637014975096336581&sdata=ktqk8oIAPoijOZ2rONBoGoJYdtKQvCqBg6BJNrAIlQo%3D&reserved=0" id="LPlnk555889" tabindex="-1" target="_blank">https://drive.google.com/drive/folders/1KYB9GyP31I9tGfwFnY7ctfUH24qvClXa?usp=sharing</a></div>
</div>
</div>

<div class=""> </div>
</div>
_______________________________________________ <a href="mailto:Pd-list@lists.iem.at" class="">Pd-list@lists.iem.at</a> mailing list UNSUBSCRIBE and account-management -> <a href="https://lists.puredata.info/listinfo/pd-list" target="_blank" class="">https://lists.puredata.info/listinfo/pd-list</a></div>
</div>
</div>
</div>
</div></div></div>
</div></blockquote></div><br class=""></div></body></html>