swami / libinstpatch

Instrument file software library.
Other
20 stars 6 forks source link

Windows-compiling #1

Closed jjceresa closed 5 years ago

jjceresa commented 5 years ago

This PR is the start of changes to get libinstpath compiled without errors using MS compilers. The changes are: 1) Adding missing files (builtin-enums.c, .h) . In previous initial archive these files was generated at make time (using glib-mkenums). 2) Minors changes to get 0 compiler errors. 3) Fixing a major bug (pertinent to Windows only). (With this bug, previous version of swami editor couldn't save any modified (or new) soundfont to disk. 4) Minor changes to get libinstpatch compiled as well as static library or shared library (dll). Actually libinstpatch is usable as a static library but not yet as a dll.

jjceresa commented 5 years ago

PR not yet completed, more commit later.

jjceresa commented 5 years ago

I guess that cast (guit8 *) done in 2a2eff0 and b34780b will produce same result than before using gcc ?.

jjceresa commented 5 years ago

Also i guess that removing uword: in eb0e96d (above) will produce same result than before using gcc ?.

jjceresa commented 5 years ago

Also may i guess that removing start_element:, end_element:, txt: in 24c3c0 (above) will produce same result than before using gcc ?.

jjceresa commented 5 years ago

Points 1,2,3 are completed. Point 4 will be done later.

derselbst commented 5 years ago

I guess that cast (guit8 *) done in 2a2eff0 and b34780b will produce same result than before using gcc ?.

Yes.

Also i guess that removing uword: in eb0e96d (above) will produce same result than before using gcc ?.

Technically it would initialize IpatchSF2GenInfo::max::sword rather than IpatchSF2GenInfo::max::uword with UMAX. The compiler may warn that UMAX cannot be represented as short. But the results should be the same.

Also may i guess that removing start_element:, end_element:, txt: in 24c3c0 (above) will produce same result than before using gcc ?.

Yes.


I just compiled with gcc's -pedantic flag and got plenty of warnings. Perhaps we should first decide whether really to re-write this as C89 compliant or go with C99. I'd vote for C99, it would require at least Visual Studio 2013 though.

jjceresa commented 5 years ago

I just compiled with gcc's -pedantic flag and got plenty of warnings.

I got also 20 warning as this: 1>......\libinstpatch-1.0.0\libinstpatch\IpatchSF2Writer.c(969): warning C4018: '<' : incompatibilité signed/unsigned 1>......\libinstpatch-1.0.0\libinstpatch\IpatchSF2Writer.c(1060): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead.

These warning should be easy to fix using proper type and/or explicit cast.

it would require at least Visual Studio 2013 though.

I am using windows XP (VS 2010). Unfortunately Windows 7 is requirement for Visual studio >= 2013. I rely on windows XP also for many running programs. I would like to keep this OS and not to be forced to buy Windows 7 and above.

C89 compliant or go with C99 ?

I dont know. The same as for Fluidsynth should be probably simpler.

derselbst commented 5 years ago

I am using windows XP (VS 2010). Unfortunately Windows 7 is requirement for Visual studio >= 2013. I rely on windows XP also for many running programs. I would like to keep this OS and not to be forced to buy Windows 7 and above.

I see. Thanks to Microsoft's monopoly, no modern C programming is possible. We are forced to program like in ancient 1989. Great.

The same as for Fluidsynth should be probably simpler.

fluidsynth has a much broader range of users than swami does. Modernizing the tools is more difficult there.

jjceresa commented 5 years ago

I see. Thanks to Microsoft's monopoly, ....

Yes, the same issue is true now with GitHub since last summer. They have changed things on their web servers. I got the followings message on top of web page:

"Please note that GitHub no longer supports old versions of Firefox. We recommend upgrading to the latest Safari, Google Chrome, or Firefox."

The problem is, one can't update Firefox, nor Google Chrome anymore because there no update for XP. In others word, to use full GitHub capabilities now Windows users are forced to buy Windows OS >= 7.

Actually here using GitHub. A lot of things doesn't work anymore:

derselbst commented 5 years ago

Actually here using GitHub. A lot of things doesn't work anymore:

I guess the github desktop app doesn't work on XP either? Have you tried opera 36.0?

jjceresa commented 5 years ago

I guess the github desktop app doesn't work on XP either?

Yes, it works only on Windows >= 7.

Have you tried opera 36.0?

It supports XP and many others. Unfortunately on GitHub i encounter the same problem than actual FireFox. Saying that i can live with these restrictions. I don't mind.


technically it would initialize IpatchSF2GenInfo::max::sword rather than IpatchSF2GenInfo::max::uword with UMAX. The compiler may warn that UMAX cannot be represented as short. But the results should be the same.

I see , i' ll check this. Thanks for all these confirmations. We can see changes are pretty minors and mainly based on explicit casting.

jjceresa commented 5 years ago

So this PR allows libinstpatch library target to compile without errors on Windows and it runs successfully when linked (static or dynamic) to swami application. I am fine with this and could be merged to master.

Next PR concerning libinstpatch library target will be to reduce this bunch of annoying signed\unsigned warning. I will propose this sooner.

riff_dump executable target still do not compile successfully due to lack of getopt_long() support on Windows. This isn't important for now but should be fixed later.