danomatika / ofxPd

(maintained) a Pure Data addon for OpenFrameworks using libpd
Other
202 stars 45 forks source link

How to add Pd external to ofxPd project in Visual Studio? #65

Closed cuinjune closed 6 years ago

cuinjune commented 6 years ago

Hi, I could successfully build an empty ofxPd project on Visual Studio. And now I'm trying to add a custom Pd external to the project. On other platforms like MacOS, I could easily do this by adding the external source file to the project and then add obj_setup() method in z_libpd.c file. (my external is called obj)

However on Windows, I can't edit the z_libpd.c file as it gets compiled into libpd.dll beforehand. So I tried to edit z_libpd.c file and then build libpd.dll first, but an error occurs saying "undefined reference to obj_setup();"

Is it possible to exclude z_libpd.c file when building libpd using make? I would like to build this file with the Visual studio so I can easily edit the file whenever I add externals. Any advise or guidance would be greatly appreciated!

danomatika commented 6 years ago

and then add obj_setup() method in z_libpd.c file. (my external is called obj)

You don't need to do that. You can declare the setup function and then call it after calling ofxPd::init(). The readme covers this: https://github.com/danomatika/ofxPd#calling-the-external-setup-function

EDIT: You shouldn't need to modify the libpd source files unless you need to fix a bug or there is functionality missing.

cuinjune commented 6 years ago

That worked. Thank you so much!