| 1 | /* fre:ac - free audio converter |
| 2 | * Copyright (C) 2001-2026 Robert Kausch <[email protected]> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License as |
| 6 | * published by the Free Software Foundation, either version 2 of |
| 7 | * the License, or (at your option) any later version. |
| 8 | * |
| 9 | * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR |
| 10 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
| 11 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ |
| 12 | |
| 13 | #include <smooth.h> |
| 14 | #include <smooth/main.h> |
| 15 | #include <smooth/args.h> |
| 16 | |
| 17 | using namespace smooth; |
| 18 | using namespace smooth::System; |
| 19 | using namespace smooth::GUI::Dialogs; |
| 20 | |
| 21 | #ifndef __WIN32__ |
| 22 | extern "C" |
| 23 | { |
| 24 | Int StartGUI(const Array<String> &); |
| 25 | } |
| 26 | #endif |
| 27 | |
| 28 | Int smooth::Main(const Array<String> &args) |
| 29 | { |
| 30 | #ifdef __WIN32__ |
| 31 | SetDllDirectory(GUI::Application::GetApplicationDirectory().Append("boca")); |
| 32 | |
| 33 | DynamicLoader *loader = new DynamicLoader("freac"); |
| 34 | |
| 35 | if (loader->GetSystemModuleHandle() != NIL) |
| 36 | { |
| 37 | Int (*StartGUI)(const Array<String> &) = (Int (*)(const Array<String> &)) loader->GetFunctionAddress("StartGUI"); |
| 38 | Int result = StartGUI(args); |
| 39 | |
| 40 | Object::DeleteObject(loader); |
| 41 | |
| 42 | return result; |
| 43 | } |
| 44 | else |
| 45 | { |
| 46 | QuickMessage(String("Unable to load dynamic library freac.dll!\n\nPossible reasons for this might be a corrupted\nfre:ac installation or missing dependencies."), "Error", Message::Buttons::Ok, Message::Icon::Error); |
| 47 | } |
| 48 | |
| 49 | Object::DeleteObject(loader); |
| 50 | |
| 51 | return -1; |
| 52 | #else |
| 53 | return StartGUI(args); |
| 54 | #endif |
| 55 | } |