| 1 | /* fre:ac - free audio converter |
| 2 | * Copyright (C) 2001-2016 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 <dllinterfaces.h> |
| 14 | |
| 15 | #ifdef __WIN32__ |
| 16 | EUCREATEUPDATECONTEXT ex_eUpdate_CreateUpdateContext = NIL; |
| 17 | EUSETCONFIGFILE ex_eUpdate_SetConfigFile = NIL; |
| 18 | EUSETLANGUAGE ex_eUpdate_SetLanguage = NIL; |
| 19 | EUFREEUPDATECONTEXT ex_eUpdate_FreeUpdateContext = NIL; |
| 20 | EUCHECKFORNEWUPDATES ex_eUpdate_CheckForNewUpdates = NIL; |
| 21 | EUAUTOMATICUPDATE ex_eUpdate_AutomaticUpdate = NIL; |
| 22 | #endif |
| 23 | |
| 24 | DynamicLoader *freac::DLLInterfaces::eupdatedll = NIL; |
| 25 | |
| 26 | Bool freac::DLLInterfaces::LoadEUpdateDLL() |
| 27 | { |
| 28 | #ifdef __WIN32__ |
| 29 | if (!File(GUI::Application::GetApplicationDirectory().Append("eUpdate.dll")).Exists()) return False; |
| 30 | |
| 31 | eupdatedll = new DynamicLoader("eUpdate"); |
| 32 | |
| 33 | ex_eUpdate_CreateUpdateContext = (EUCREATEUPDATECONTEXT) eupdatedll->GetFunctionAddress("eUpdate_CreateUpdateContext"); |
| 34 | ex_eUpdate_SetConfigFile = (EUSETCONFIGFILE) eupdatedll->GetFunctionAddress("eUpdate_SetConfigFile"); |
| 35 | ex_eUpdate_SetLanguage = (EUSETLANGUAGE) eupdatedll->GetFunctionAddress("eUpdate_SetLanguage"); |
| 36 | ex_eUpdate_FreeUpdateContext = (EUFREEUPDATECONTEXT) eupdatedll->GetFunctionAddress("eUpdate_FreeUpdateContext"); |
| 37 | ex_eUpdate_CheckForNewUpdates = (EUCHECKFORNEWUPDATES) eupdatedll->GetFunctionAddress("eUpdate_CheckForNewUpdates"); |
| 38 | ex_eUpdate_AutomaticUpdate = (EUAUTOMATICUPDATE) eupdatedll->GetFunctionAddress("eUpdate_AutomaticUpdate"); |
| 39 | |
| 40 | if (ex_eUpdate_CreateUpdateContext == NIL || |
| 41 | ex_eUpdate_SetConfigFile == NIL || |
| 42 | ex_eUpdate_SetLanguage == NIL || |
| 43 | ex_eUpdate_FreeUpdateContext == NIL || |
| 44 | ex_eUpdate_CheckForNewUpdates == NIL || |
| 45 | ex_eUpdate_AutomaticUpdate == NIL) { FreeEUpdateDLL(); return False; } |
| 46 | |
| 47 | return True; |
| 48 | #else |
| 49 | return False; |
| 50 | #endif |
| 51 | } |
| 52 | |
| 53 | Void freac::DLLInterfaces::FreeEUpdateDLL() |
| 54 | { |
| 55 | Object::DeleteObject(eupdatedll); |
| 56 | } |