Talk:Beginner's Basic Plugin Guide

From Winamp Developer Wiki
Revision as of 18:10, 2 July 2009 by SMonty (Talk | contribs)

Jump to: navigation, search

Is this format okay?

Hey everyone, this is my first work with any Winamp plugin code and my first edits to the wiki. Sorry if anything is in the wrong format or wrong place. Please feel free to move or work on it; I'm open to suggestions on how to improve. --Culix 02:29, 10 June 2009 (UTC)

Questions and TODO

I still have a few questions about writing plugins. These should probably be filled into the guide at some point. --Culix 02:34, 10 June 2009 (UTC)

  • How do the naming conventions work for plugins? It seems more complicated than simply naming your file 'gen_*' or 'ml_*'.

The answer to this is complicated, as so much with Winamp. The prefix is actually used by Winamp.exe to find plugins and identify what type they are. There is another way to create plugins that does not require the prefix. This second way is called Wasabi. Wasabi is a way to 'share' code among components of a software system (i.e., Winamp). Wasabi dlls do not need the prefix. We'll get to Wasabi if we keep writing these kinds of tutorials. Is there something specific about the prefixes that leads you to believe that there is a 'real' answer? Maybe I can investigate further.

  • For the "cannot convert parameter from 'const char [x]' to 'LPCTSTR'" error, which option from the MSDN FAQ should we actually use? Is it better to change the project settings to use a multi-byte character set?

I would not change the project settings and instead use the L"" or _TEXT constructs to indicate that the strings are wide strings. Winamp programmers prefer to be even more specific and actually call the MessageBoxW() or MessageBoxA() methods to make it absolutely clear as to which function and what form the input is in (this would make the project switch meaningless). Since Winamp is a very popular application around the world it is best to use UNICODE.

Having said that, Winamp is also ancient (in computer years) and so every once in a while you might run across places within Winamp that do not handle UNICODE and will require ASCII strings. For example, notice the description field of the winampGeneralPurposePlugin structure. It was never converted to use UNICODE since that would change the size of the structure requiring a new revision and all the attendant problems that go along with that.

  • Why do some people put their 'extern "C" __declspec' code in the header and others in the .cpp? Does it matter?

The point of the extern "C" is to tell the linker not to perform C++ name mangling on the function name. This is necessary when some other application needs to invoke the method and therefore needs to use a name that is easier to use. Technically it doesn't matter whether you put them in a header or cpp file and it boils down to the more common reasons why you choose to put things in header files rather than including them in the cpp file.

Next Steps

I think a good extension of this article would be to answer the user's question of "Okay, now what?". If we could give them hints about where to go next, possibly depending on the type of plugin they want to write, that might be useful. This may just involve fleshing out the guide articles for each type of plugin and then linking to those... unless someone can think of something better? --Culix 14:54, 10 June 2009 (UTC)