Compiling a plugin using dev-c++/gcc 2003-05-16 01:18:50 warning: I'm not very good at this. If you're easily offended by stupid mistakes, you should probably leave.Ok, a while back someone tried to get the foobar sdk to compile using dev-c++, which uses gcc as its compiler. See here. Since I'd like to try to write a plugin sometime, but don't intend to buy and install a complete microsoft ide just for that, this interested me. Unfortunately, Ricky12369 didn't get very far. I got a bit further. The compiler managed to produce a foo_albumlist.dll. However, there are some important differences between "my" foo_albumlist.dll and the one supplied with foobar:1. Foobar's dll is about 15 KB in size, mine is about 360 KB. I knew that the missing support for _declspec(novtable) was going to make a difference, but not this kind of a difference 2. Foobar's dll (obviously) works. Mine doesn't. It crashes foobar on startup. Now there's actually something good about that. If I put a random dll or a random textfile in foobar's directory and call it foo_albumlist.dll, foobar refuses to open it. My dll is apparently recognized as an attempt at a foobar plugin. Now if it would just not crash foobar...In case anybody is willing and able to help me here, I've put the dll, the dev-c++ project and the buildlog online. Warning: that log is rather large. It mainly consists of warnings about "taking address of temporary" and "base class `class blah' should be explicitly initialized in the copy constructor". Also some instances of "In constructor `string_printf::string_printf(const char*, ...)' char is promoted to int when passed through `...' (so you should pass `int' not `char' to `va_arg')". There might be some "real" warnings there I've missed though. I'll go through it again tomorrow.In order to get it to compile, I have done the following:First the project. This consists of the imported version of the dsp file in the foo_albumlist directory, changed to produce a dll (building foo_albumlist.exe fails miserably on a missing winmain) and changed to include all the cpp files in the pfc and sdk directories, and component_client.cpp, but not profiler.cpp and directory.cpp (these two wouldn't compile, and removing them didn't produce any problems in linking).Then the source. I had to make the following changes. BEWARE: I'm a moron. I don't know enough about c++ to be safely allowed near this kind of source. This was your final warning 0. Added newlines to the end of the files. gcc doesn't like it when they're not there.1. string.h: the typedef for WCHAR conflicts with a typedef wchar_t WCHAR, so I commented it out. Don't know why the #ifndef WCHAR didn't catch this.2. string.h: void xor(myChar x) changed to operator void xor(myChar x). gcc claims xor is a c++ operator, equivalent to ^. This was the problem the previous builder of this stuff ran into.3. changed #define NOVTABLE _declspec(novtable) into #define NOVTABLE in /pfc/cfg_var.h and /pfc/pfc.h (gcc doesn't support this).4. included wctype.h in utf8.cpp, to get towlower and towupper.5. included ctype.h in string.cpp, to get tolower and toupper.6. playlist_loader.cpp: added casts. This is the spot I was least sure of myself. It now reads: string8 extension = (const char*)string_extension_8(filename); and string8 ext = (const char*)string_extension_8(filename); and it doesn't compile without those casts. I don't know if it'll do what it's supposed to with them, though. I hope it does.7. albumlist.rc: changed afxres.h into winresrc.h (suggested by google) and added #define IDC_STATIC (-1). This define was #if 0'd out in my system headers.8. main.cpp: made metadb_enum_callback::on_entry(metadb_handle*, file_info const*) pure virtual. The function is declared as ordinary virtual function in a class with NOVTABLE, and (as far as I can see) never implemented. There is a derived class that does. Without making it pure virtual, the linker catches it as an unresolved external.That's it, I think. Now if someone could tell me what I'm doing wrong, or that this is just never going to work because the compilers are too incompatible, I'd be happy.Oh, before I forget: dev-c++ version 18.104.22.168, gcc version 3.2, win2k.Thanks in advance.