| 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 | |
| 20 | #ifndef __WIN32__ |
| 21 | extern "C" |
| 22 | { |
| 23 | Int StartConsole(const Array<String> &); |
| 24 | } |
| 25 | #endif |
| 26 | |
| 27 | Int smooth::Main(const Array<String> &args) |
| 28 | { |
| 29 | #ifdef __WIN32__ |
| 30 | SetDllDirectory(GUI::Application::GetApplicationDirectory().Append("boca")); |
| 31 | |
| 32 | DynamicLoader *loader = new DynamicLoader("freac"); |
| 33 | |
| 34 | if (loader->GetSystemModuleHandle() != NIL) |
| 35 | { |
| 36 | Int (*StartConsole)(const Array<String> &) = (Int (*)(const Array<String> &)) loader->GetFunctionAddress("StartConsole"); |
| 37 | Int result = StartConsole(args); |
| 38 | |
| 39 | Object::DeleteObject(loader); |
| 40 | |
| 41 | return result; |
| 42 | } |
| 43 | else |
| 44 | { |
| 45 | Console::OutputString(String("Error: Unable to load dynamic library freac.dll!\n\n Possible reasons for this might be a corrupted\n fre:ac installation or missing dependencies.\n")); |
| 46 | } |
| 47 | |
| 48 | Object::DeleteObject(loader); |
| 49 | |
| 50 | return -1; |
| 51 | #else |
| 52 | return StartConsole(args); |
| 53 | #endif |
| 54 | } |