Skip to main content
Topic: 2005: A Code Odyssey (Read 7383 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

2005: A Code Odyssey

Hi,

I'm new to C++. It's been on my to-do list for a while, but it was foobar2000, the SDK and the plugin collection which inspired me to finally get my hands dirty

I've just got foo_static_panel, musicmusic's demo panel which is essentially a "Hello World" columns_ui toolbar, to compile using Microsoft Visual C++ Express Edition 2005 Beta 2 - a free download from Microsoft with the same compiler etc as the full Visual Studio version. If you want to try this out you'll also need the Windows Platform SDK.

Anyway, to cut a long story short, I had to make three amendments to the SDK and one to the component code to get the project to compile, and I thought I'd post my changes here in case they're of use to anyone

/SDK/pfc/string.cpp(478) : error C2668 : ambiguous call to overloaded function
Code: [Select]
changed:
    _i64toa((__int64)(val * pow(10,precision)),temp,10);
to:
    const long double ld = 10;
    float f = pow(ld,static_cast<int>(precision));
    _i64toa((__int64)(val * f),temp,10);


/SDK/pfc/string.h(5) : error C2371 : 'WCHAR' redefinition; different basic types
Code: [Select]
commented out:
    typedef unsigned short WCHAR;


/SDK/pfc/string.h(475) : error C4430 : missing type specifier - int assumed.
Code: [Select]
changed:
    inline string_simple(const string_simple_t<T> & param) {ptr = t_strdup(param);}
to:
    inline void string_simple(const string_simple_t<T> & param) {ptr = t_strdup(param);}



/foo_static_panel(6) : error C1189 : Deprecated - use ui_extension_with_helpers.h instead
Code: [Select]
changed:
    #include "../ui_extension/helpers.h"
to:
    #include "../ui_extension/ui_extension_with_helpers.h"



So yeah - I've now got a blank toolbar with the word "moo" on it 

It's a start. Next I'm going to try foo_uie_albumlist...


EDIT: I remembered the fourth change

2005: A Code Odyssey

Reply #1
Me again.

foo_uie_albumlist was pretty easy  Two changes - one to the SDK and one to the component.

\SDK\helpers\playpack_order_helper.h(23) : error C4430 : missing type specifier - int assumed.
Code: [Select]
changed:
    inline order_exists(const char * name) {return get_index_from_name(name)!=order_invalid;}
to:
    inline unsigned order_exists(const char * name) {return get_index_from_name(name)!=order_invalid;}


\foo_uie_albumlist\main.cpp(1366) : error C4430 : missing type specifier - int assumed.
Code: [Select]
changed:
    static process_char = true;
to:
    static bool process_char = true;



Oh, and I capitalized the "m" in "All music", because it was driving me nuts

2005: A Code Odyssey

Reply #2
OK, I'm starting to make some headway now

musicmusic has on his website a modified version of foo_search_ex which works as a panel or a dialog. I downloaded it, hacked it around and made it output it's results to a new playlist rather than the listbox. I flattened out the dialog, re-classified it from a panel to a toolbar, and come up with something a bit similar to the quickfind feature in v0.9.

I've also slightly tweaked a copy of foo_freedb, to get it to tell me when a search has failed, or no results have been returned. I don't know about anyone else, but it always left me wondering whether it was still going, or my internet connection had gone down or something... 


Anyway, they're both available here if anyone's interested. I can't provide direct links to download from because my ISP doesn't like it, so you'll have to visit the page I'm afraid to download anything.

my foobar2000 page

2005: A Code Odyssey

Reply #3
I like the changes you have made to foo_freedb, I will try that out sometime.

2005: A Code Odyssey

Reply #4
When i use your plugin - Foobar2000 write  to console
"Unable load DLL MSVCR80D.dll"

Where I can download this DLL?

2005: A Code Odyssey

Reply #5
Sounds like a debug build. I have also been wondering about the dynamic runtime modules, now that they are installed to %SystemRoot%\WinSxS and imported via assembly manifest.


 

2005: A Code Odyssey

Reply #8
With last version of your plugins I have system message box when start foobar2000:
"entry point  _clean_type_info_names_internal not found in DLL library MSVCR80.DLL"

I use MSVCR80.DLL ver. 8.00.40607.42 (file size 585728).

In previous version of your plugins I use MSVCR80D.DLL ver. 8.00.50215.44 and all was corect.

If your version of MSVCR80.DLL is new then one I used - can you get link to it.

2005: A Code Odyssey

Reply #9
Quote
With last version of your plugins I have system message box when start foobar2000:
"entry point   _clean_type_info_names_internal not found in DLL library MSVCR80.DLL"

I use MSVCR80.DLL ver. 8.00.40607.42 (file size 585728).

In previous version of your plugins I use MSVCR80D.DLL ver. 8.00.50215.44 and all was corect.

If your version of MSVCR80.DLL is new then one I used - can you get link to it.
[a href="index.php?act=findpost&pid=315257"][{POST_SNAPBACK}][/a]


I have the 50215 version of the dll on my machine, and after installing a copy of 40607 which has the file size you quote, had the same problem.

The date on the 40607 dll I have is 14th November 2004, wheras the 50215 is 8th April 2005. The file size of the 50215 version is also larger at 614,400. 50215 also matches the version number of the .NET Framework I have installed.

I'm not really sure what to suggest about fixing it, other than reverting to the 50215 version of the dll.

Anyone else got any ideas?

2005: A Code Odyssey

Reply #10
Just picking a few nits.

Quote
/SDK/pfc/string.cpp(478) : error C2668 : ambiguous call to overloaded function
Code: [Select]
changed:
    _i64toa((__int64)(val * pow(10,precision)),temp,10);
to:
    const long double ld = 10;
    float f = pow(ld,static_cast<int>(precision));
    _i64toa((__int64)(val * f),temp,10);

[a href="index.php?act=findpost&pid=311910"][{POST_SNAPBACK}][/a]


Probably making it "pow(10.0, precision)" or "pow(10.0L, precision)" would've worked too.

Quote
/SDK/pfc/string.h(475) : error C4430 : missing type specifier - int assumed.
Code: [Select]
changed:
    inline string_simple(const string_simple_t<T> & param) {ptr = t_strdup(param);}
to:
    inline void string_simple(const string_simple_t<T> & param) {ptr = t_strdup(param);}

[a href="index.php?act=findpost&pid=311910"][{POST_SNAPBACK}][/a]


I strongly suspect that was intended to be a copy constructor (altho the typical "avoid copying myself" check is not present), so the proper fix would likely be to rename this to string_simple_t rather than adding a void return type.

Quote
\SDK\helpers\playpack_order_helper.h(23) : error C4430 : missing type specifier - int assumed.
Code: [Select]
changed:
    inline order_exists(const char * name) {return get_index_from_name(name)!=order_invalid;}
to:
    inline unsigned order_exists(const char * name) {return get_index_from_name(name)!=order_invalid;}

[a href="index.php?act=findpost&pid=311912"][{POST_SNAPBACK}][/a]


Given that this returns a boolean expression ("x != y"), the proper return type should probably be "bool", not "unsigned".

Otherwise, good changes.  Please do try to avoid releasing anything built with a beta compiler - the runtime DLLs change with every iteration so you just end up polluting your user's machine with potentially unstable DLLs.

2005: A Code Odyssey

Reply #11
Zastai,

Thanks for your input. I'm not really sure what I'm doing yet and suggestions for better ways of doing things are appreciated

Quote
Quote
\SDK\helpers\playpack_order_helper.h(23) : error C4430 : missing type specifier - int assumed.

Given that this returns a boolean expression ("x != y"), the proper return type should probably be "bool", not "unsigned".
Yes, absolutely.


Quote
Quote
/SDK/pfc/string.cpp(478) : error C2668 : ambiguous call to overloaded function

Probably making it "pow(10.0, precision)" or "pow(10.0L, precision)" would've worked too.
Unfortunately not. I tried it both ways you suggested and got C2668 both times.

EDIT
after adding
Code: [Select]
#pragma warning(disable: 4996)
to string.h to hide the reems of compiler warnings about deprecated functions (I've decided to ignore all these and see if they appear in the v0.9 SDK) I noticed that my fix had caused "warning C4244: 'initializing' : conversion from 'long double' to 'float', possible loss of data" 

I changed it to
Code: [Select]
float f = pow( (float)10.0 , (int)precision );
_i64toa((__int64)(val * f),temp,10);
and that works better
/EDIT

Quote
Quote
/SDK/pfc/string.h(475) : error C4430 : missing type specifier - int assumed.

I strongly suspect that was intended to be a copy constructor (altho the typical "avoid copying myself" check is not present), so the proper fix would likely be to rename this to string_simple_t rather than adding a void return type.
I'm not sure I follow what you mean. Would you mind clarifying this further?


Quote
Please do try to avoid releasing anything built with a beta compiler - the runtime DLLs change with every iteration so you just end up polluting your user's machine with potentially unstable DLLs.
I'm going to carry on using 2005, thanks. I'm not aware of any stability issues with the compiler, and I think anyone reading the dev forum is going to be reasonably comfortable removing redundant dlls if they need to.

2005: A Code Odyssey

Reply #12
Quote
With last version of your plugins I have system message box when start foobar2000:
"entry point   _clean_type_info_names_internal not found in DLL library MSVCR80.DLL"

I use MSVCR80.DLL ver. 8.00.40607.42 (file size 585728).

In previous version of your plugins I use MSVCR80D.DLL ver. 8.00.50215.44 and all was corect.

If your version of MSVCR80.DLL is new then one I used - can you get link to it.
[a href="index.php?act=findpost&pid=315257"][{POST_SNAPBACK}][/a]


More idiocy, this time partially Microsoft's fault. Beta 2 has newer runtime modules.


These modules should not be copied to your system directory. They are normally installed under the WinSxS directory and imported by a signed manifest directive, the same as the newer Common Controls. Version clashes like this are a very good reason.

Microsoft may change this when the final version is released, but this system-wide installation with signed importing may be more useful. For future reference, bundle the required runtime modules, or provide them in a separate archive, until such time that Microsoft has finalized this issue and has started providing their own redistributable package for system-wide installation.

Again, people, STOP STUFFING BETA RUNTIME MODULES IN YOUR SYSTEM DIRECTORY.

For reference, the directory names, excluding the IA64 builds which I didn't install:
Quote
amd64_Microsoft.VC80.ATL_1fc8b3b9a1e18e3b_8.0.50215.4652_x-ww_4a588028
amd64_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50215.4652_x-ww_e9b892b4
amd64_Microsoft.VC80.DebugCRT_1fc8b3b9a1e18e3b_8.0.50215.4652_x-ww_d336d953
amd64_Microsoft.VC80.DebugMFC_1fc8b3b9a1e18e3b_8.0.50215.4652_x-ww_a41d4c58
amd64_Microsoft.VC80.DebugOpenMP_1fc8b3b9a1e18e3b_8.0.50215.4652_x-ww_429040ef
amd64_Microsoft.VC80.MFCLOC_1fc8b3b9a1e18e3b_8.0.50215.4652_x-ww_0fee1eb7
amd64_Microsoft.VC80.MFC_1fc8b3b9a1e18e3b_8.0.50215.4652_x-ww_ba9f05b9
amd64_Microsoft.VC80.OpenMP_1fc8b3b9a1e18e3b_8.0.50215.4652_x-ww_eabe604e
x86_Microsoft.VC80.ATL_1fc8b3b9a1e18e3b_8.0.50215.4652_x-ww_184e9a48
x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50215.4652_x-ww_b7aeacd4
x86_Microsoft.VC80.DebugCRT_1fc8b3b9a1e18e3b_8.0.50215.4652_x-ww_a12cf373
x86_Microsoft.VC80.DebugMFC_1fc8b3b9a1e18e3b_8.0.50215.4652_x-ww_72136678
x86_Microsoft.VC80.DebugOpenMP_1fc8b3b9a1e18e3b_8.0.50215.4652_x-ww_10865b0f
x86_Microsoft.VC80.MFCLOC_1fc8b3b9a1e18e3b_8.0.50215.4652_x-ww_dde438d7
x86_Microsoft.VC80.MFC_1fc8b3b9a1e18e3b_8.0.50215.4652_x-ww_88951fd9
x86_Microsoft.VC80.OpenMP_1fc8b3b9a1e18e3b_8.0.50215.4652_x-ww_b8b47a6e

2005: A Code Odyssey

Reply #13
foo_uie_trackinfo

I've been playing around with foo_uie_trackinfo, and I've added an additional timer so that the panel can be updated at intervals in milliseconds rather than every second, and the panel also gets updated while in follow cursor mode and when foobar2000 isn't playing.

I've also added some additional TAGZ fields:
--> %_system_time%: currrent time in HH:MM:SS format
--> %_system_time_ms%: current time milliseconds

I'm going to try to use these to make some cool animation effects 

2005: A Code Odyssey

Reply #14
Quote
Quote
Please do try to avoid releasing anything built with a beta compiler - the runtime DLLs change with every iteration so you just end up polluting your user's machine with potentially unstable DLLs.
I'm going to carry on using 2005, thanks. I'm not aware of any stability issues with the compiler, and I think anyone reading the dev forum is going to be reasonably comfortable removing redundant dlls if they need to.
[a href="index.php?act=findpost&pid=315571"][{POST_SNAPBACK}][/a]


These redundant DLL files would not be redundant in the first place if they were installed properly. Unfortunately, the only thing I know of which installs them properly is Visual Studio itself.

While it is a good idea to break in the new kit, I would discourage installing required dynamic runtime anywhere in the system directories. In fact, it may even be a good idea to add a separate "Release staticlink" or "Release MT" target to all projects, and set runtime to static multi-threaded.

An IMPORTANT note when converting MSVC 6 projects for use with MSVC 7.1 or 8: The converter does not catch static paths, such as output and intermediate directories, but most importantly, the C/C++ object/assembly/etc output directories, the precompiled header paths, and the project database paths. You will have to manually set the following, advisably before duping the existing Release target:

Output: ..\$(ConfigurationName)
Intermediate: $(ConfigurationName)

Object/Assembly/etc: $(IntDir)\

Substite $(IntDir) or $(OutDir) where appropriate for existing ".\Release\" or "../.\Release\" or such. When duping to new configurations, the IDE will catch the main Output and Intermediate paths, and set both to $(ConfigurationName), but it won't catch the C/C++ output paths, which will still be ".\Release\" or so. Boo.

Static builds should not be terribly larger, and probably the best course of action for distributing software built with the beta kit.

 
SimplePortal 1.0.0 RC1 © 2008-2019