porres / pd-else

ELSE - EL Locus Solus' Externals for Pure Data
Do What The F*ck You Want To Public License
292 stars 36 forks source link

Variable and zero length arrays in keyboard, metronome and rec objects don't compile with MSVC #1182

Closed timothyschoen closed 2 years ago

timothyschoen commented 2 years ago

keyboard, metronome and rec don't compile with MSVC because it has no support for variable length arrays.

In keyboard it happens on line 63, 73, 156 and 357. These are all unnecessary VLA's because the size is constant.

The ones in rec are on line 191 and 206, these are actually VLA's, and need to be replaced with heap allocation.

In metronome the bug is a bit different, it creates an array of size 0 which is also not supported by MSVC. These are passed to the typedmess function, but can probably just be NULL instead?

also, small one: pic.c includes unistd.h, but without #ifndef _MSC_VER

After that it should compile for MSVC! I guess you could just use MSYS/MINGW, but for including it in (JUCE) projects like Camomile-ELSE and PlugData, it's very convenient if it works with MSVC.

timothyschoen commented 2 years ago

I'm fixing all these issues anyways because I want to release a new version of PlugData hopefully tonight. Shall I send you a pull request?

porres commented 2 years ago

a PR for this would be great, thanks!

porres commented 2 years ago

but are you gonna include the unreleeased beta 46 version?

timothyschoen commented 2 years ago

Yeah, PlugData is also still in pre-release so it's fine for now.

porres commented 2 years ago

note that rec is also based on cyclone/mtr, which should have the same issues, maybe we need a PR for that too ;)

timothyschoen commented 2 years ago

I've fixed MSCV support in PlugData now, I'm a little busy fixing issues still but in a few days I'll have a pull request ready. Another issue is the dir object, it uses which is not available on MSVC.

porres commented 2 years ago

by the way, this may also affect plugdata https://github.com/porres/pd-else/issues/1174

timothyschoen commented 2 years ago

I've confirmed that this affects PlugData, very strange bug though.

porres commented 2 years ago

I'm fixing all these issues anyways because I want to release a new version of PlugData hopefully tonight. Shall I send you a pull request?

wher'es the PR? :)

timothyschoen commented 2 years ago

Not there yet :(

The problem is that some objects like dir (and I believe some more) don't work with MSCV at all. I've just disabled them in PlugData, but for the pull request I have to actually fix those objects. I'm also not a Windows user, which makes it more difficult.

I could send you a PR for the other issues first if you'd like?

porres commented 2 years ago

I could send you a PR for the other issues first if you'd like?

ok

timothyschoen commented 2 years ago

I've made a PR fixing most issues here, except for the ones in pic and dir.

porres commented 2 years ago

I may try to redo [dir] as an abstraction based on [file] and [pdcontrol], what do you think? Can you compile [file] alright?

porres commented 2 years ago

can you fix the issue with pic?

timothyschoen commented 2 years ago

I can compile file, it would be great to have dir based on file! I can solve the issue with pic, it just involves writing a wrapper like I did for mousepad and keyboard, should be pretty simple.

porres commented 2 years ago

it would be great to have dir based on file!

not that easy, i'd rather not have to... [file] should have more functionalities to make things easier...

timothyschoen commented 2 years ago

Maybe something like this could help:

https://github.com/tronkko/dirent

It's a single header dirent.h replacement for Windows, should be very simple to get it working this way.

porres commented 2 years ago

can we close this?

timothyschoen commented 2 years ago

yes!