/// <summary> /// Get the native library symbols and map them to the appropriate functions/delegates. /// </summary> private void Initialize() { string symbolMappingError = "Delegate of an exported function couldn't be created for symbol '{0}'"; this.gsapi_revision = _library.GetDelegateForFunction <gsapi_revision>("gsapi_revision"); if (this.gsapi_revision == null) { throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_revision")); } gsapi_revision_s rev = new gsapi_revision_s(); if (this.gsapi_revision(ref rev, System.Runtime.InteropServices.Marshal.SizeOf(rev)) == 0) { _revision = rev.revision; } this.gsapi_new_instance = _library.GetDelegateForFunction <gsapi_new_instance>("gsapi_new_instance"); if (this.gsapi_new_instance == null) { throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_new_instance")); } this.gsapi_delete_instance = _library.GetDelegateForFunction <gsapi_delete_instance>("gsapi_delete_instance"); if (this.gsapi_delete_instance == null) { throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_delete_instance")); } this.gsapi_set_stdio = _library.GetDelegateForFunction <gsapi_set_stdio>("gsapi_set_stdio"); if (this.gsapi_set_stdio == null) { throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_set_stdio")); } this.gsapi_set_poll = _library.GetDelegateForFunction <gsapi_set_poll>("gsapi_set_poll"); if (this.gsapi_set_poll == null) { throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_set_poll")); } this.gsapi_set_display_callback = _library.GetDelegateForFunction <gsapi_set_display_callback>("gsapi_set_display_callback"); if (this.gsapi_set_display_callback == null) { throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_set_display_callback")); } if (is_gsapi_set_arg_encoding_supported) { this.gsapi_set_arg_encoding = _library.GetDelegateForFunction <gsapi_set_arg_encoding>("gsapi_set_arg_encoding"); if (this.gsapi_set_arg_encoding == null) { throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_set_arg_encoding")); } } this.gsapi_init_with_args = _library.GetDelegateForFunction <gsapi_init_with_args>("gsapi_init_with_args"); if (this.gsapi_init_with_args == null) { throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_init_with_args")); } this.gsapi_run_string_begin = _library.GetDelegateForFunction <gsapi_run_string_begin>("gsapi_run_string_begin"); if (this.gsapi_run_string_begin == null) { throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_run_string_begin")); } this.gsapi_run_string_continue = _library.GetDelegateForFunction <gsapi_run_string_continue>("gsapi_run_string_continue"); if (this.gsapi_run_string_continue == null) { throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_run_string_continue")); } this.gsapi_run_string_end = _library.GetDelegateForFunction <gsapi_run_string_end>("gsapi_run_string_end"); if (this.gsapi_run_string_end == null) { throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_run_string_end")); } this.gsapi_run_string_with_length = _library.GetDelegateForFunction <gsapi_run_string_with_length>("gsapi_run_string_with_length"); if (this.gsapi_run_string_with_length == null) { throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_run_string_with_length")); } this.gsapi_run_string = _library.GetDelegateForFunction <gsapi_run_string>("gsapi_run_string"); if (this.gsapi_run_string == null) { throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_run_string")); } this.gsapi_run_file = _library.GetDelegateForFunction <gsapi_run_file>("gsapi_run_file"); if (this.gsapi_run_file == null) { throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_run_file")); } this.gsapi_exit = _library.GetDelegateForFunction <gsapi_exit>("gsapi_exit"); if (this.gsapi_exit == null) { throw new GhostscriptException(string.Format(symbolMappingError, "gsapi_exit")); } }
private void Initialize() { this.gsapi_revision = _library.GetDelegateForFunction("gsapi_revision", typeof(gsapi_revision)) as gsapi_revision; this.gsapi_new_instance = _library.GetDelegateForFunction("gsapi_new_instance", typeof(gsapi_new_instance)) as gsapi_new_instance; this.gsapi_delete_instance = _library.GetDelegateForFunction("gsapi_delete_instance", typeof(gsapi_delete_instance)) as gsapi_delete_instance; this.gsapi_set_stdio = _library.GetDelegateForFunction("gsapi_set_stdio", typeof(gsapi_set_stdio)) as gsapi_set_stdio; this.gsapi_set_poll = _library.GetDelegateForFunction("gsapi_set_poll", typeof(gsapi_set_poll)) as gsapi_set_poll; this.gsapi_set_display_callback = _library.GetDelegateForFunction("gsapi_set_display_callback", typeof(gsapi_set_display_callback)) as gsapi_set_display_callback; this.gsapi_init_with_args = _library.GetDelegateForFunction("gsapi_init_with_args", typeof(gsapi_init_with_args)) as gsapi_init_with_args; this.gsapi_run_string_begin = _library.GetDelegateForFunction("gsapi_run_string_begin", typeof(gsapi_run_string_begin)) as gsapi_run_string_begin; this.gsapi_run_string_continue = _library.GetDelegateForFunction("gsapi_run_string_continue", typeof(gsapi_run_string_continue)) as gsapi_run_string_continue; this.gsapi_run_string_end = _library.GetDelegateForFunction("gsapi_run_string_end", typeof(gsapi_run_string_end)) as gsapi_run_string_end; this.gsapi_run_string_with_length = _library.GetDelegateForFunction("gsapi_run_string_with_length", typeof(gsapi_run_string_with_length)) as gsapi_run_string_with_length; this.gsapi_run_string = _library.GetDelegateForFunction("gsapi_run_string", typeof(gsapi_run_string)) as gsapi_run_string; this.gsapi_run_file = _library.GetDelegateForFunction("gsapi_run_file", typeof(gsapi_run_file)) as gsapi_run_file; this.gsapi_exit = _library.GetDelegateForFunction("gsapi_exit", typeof(gsapi_exit)) as gsapi_exit; }
public bassAudioCore() { for (var i = 0; i < _lastPeak.Length; i++) { _lastPeak[i] = 0f; } memDll = new DynamicNativeLibrary(Assembly.GetExecutingAssembly().FindEmbedded("bass.dll")); InitBass = (BASS_Init)memDll.GetDelegateForFunction("BASS_Init", typeof(BASS_Init)); if (InitBass(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero, IntPtr.Zero)) { BassFree = (BASS_Free)memDll.GetDelegateForFunction("BASS_Free", typeof(BASS_Free)); ChannelPause = (BASS_ChannelPause)memDll.GetDelegateForFunction("BASS_ChannelPause", typeof(BASS_ChannelPause)); ChannelStop = (BASS_ChannelStop)memDll.GetDelegateForFunction("BASS_ChannelStop", typeof(BASS_ChannelStop)); ChannelPlay = (BASS_ChannelPlay)memDll.GetDelegateForFunction("BASS_ChannelPlay", typeof(BASS_ChannelPlay)); MusicLoadMemory = (BASS_MusicLoad)memDll.GetDelegateForFunction("BASS_MusicLoad", typeof(BASS_MusicLoad)); GetData = (BASS_ChannelGetData)memDll.GetDelegateForFunction("BASS_ChannelGetData", typeof(BASS_ChannelGetData)); GetData2 = (BASS_ChannelGetData2)memDll.GetDelegateForFunction("BASS_ChannelGetData", typeof(BASS_ChannelGetData2)); GetData3 = (BASS_ChannelGetData3)memDll.GetDelegateForFunction("BASS_ChannelGetData", typeof(BASS_ChannelGetData3)); GetData4 = (BASS_ChannelGetData4)memDll.GetDelegateForFunction("BASS_ChannelGetData", typeof(BASS_ChannelGetData4)); GetInfo = (BASS_ChannelGetInfo)memDll.GetDelegateForFunction("BASS_ChannelGetInfo", typeof(BASS_ChannelGetInfo)); GetChanLength = (BASS_ChannelGetLength)memDll.GetDelegateForFunction("BASS_ChannelGetLength", typeof(BASS_ChannelGetLength)); GetSeconds2Bytes = (BASS_ChannelSeconds2Bytes)memDll.GetDelegateForFunction("BASS_ChannelSeconds2Bytes", typeof(BASS_ChannelSeconds2Bytes)); SetConfig = (BASS_SetConfig)memDll.GetDelegateForFunction("BASS_SetConfig", typeof(BASS_SetConfig)); GetIsActive = (BASS_ChannelIsActive)memDll.GetDelegateForFunction("BASS_ChannelIsActive", typeof(BASS_ChannelIsActive)); SetChannelPos = (BASS_ChannelSetPosition)memDll.GetDelegateForFunction("BASS_ChannelSetPosition", typeof(BASS_ChannelSetPosition)); GetBytes2Seconds = (BASS_ChannelBytes2Seconds)memDll.GetDelegateForFunction("BASS_ChannelBytes2Seconds", typeof(BASS_ChannelBytes2Seconds)); StreamCreateFileMemory = (BASS_StreamCreateFile)memDll.GetDelegateForFunction("BASS_StreamCreateFile", typeof(BASS_StreamCreateFile)); StreamFreeA = (BASS_StreamFree)memDll.GetDelegateForFunction("BASS_StreamFree", typeof(BASS_StreamFree)); GetChannelLevel = (BASS_ChannelGetLevel)memDll.GetDelegateForFunction("BASS_ChannelGetLevel", typeof(BASS_ChannelGetLevel)); GetChannelTags = (BASS_ChannelGetTags)memDll.GetDelegateForFunction("BASS_ChannelGetTags", typeof(BASS_ChannelGetTags)); GetErrorCode = (BASS_ErrorCode)memDll.GetDelegateForFunction("BASS_ErrorGetCode", typeof(BASS_ErrorCode)); PluginFree = (BASS_PluginFree)memDll.GetDelegateForFunction("BASS_PluginFree", typeof(BASS_PluginFree)); PluginLoad = (BASS_PluginLoad)memDll.GetDelegateForFunction("BASS_PluginLoad", typeof(BASS_PluginLoad)); } }
/// <summary> /// Get the native library symbols and map them to the appropriate functions/delegates. /// </summary> private void Initialize() { // string symbolMappingError = "Delegate of an exported function couldn't be created for symbol '{0}'"; this.FPDF_ActionGetType = _library.GetDelegateForFunction <FPDF_ActionGetType>("FPDF_ActionGetType"); this.FPDF_AddRef = _library.GetDelegateForFunction <FPDF_AddRef>("FPDF_AddRef"); this.FPDF_BookmarkGetAction = _library.GetDelegateForFunction <FPDF_BookmarkGetAction>("FPDF_BookmarkGetAction"); this.FPDF_BookmarkGetDest = _library.GetDelegateForFunction <FPDF_BookmarkGetDest>("FPDF_BookmarkGetDest"); this.FPDF_BookmarkGetFirstChild = _library.GetDelegateForFunction <FPDF_BookmarkGetFirstChild>("FPDF_BookmarkGetFirstChild"); this.FPDF_BookmarkGetNextSibling = _library.GetDelegateForFunction <FPDF_BookmarkGetNextSibling>("FPDF_BookmarkGetNextSibling"); this.FPDF_BookmarkGetTitle = _library.GetDelegateForFunction <FPDF_BookmarkGetTitle>("FPDF_BookmarkGetTitle"); this.FPDF_CloseDocument = _library.GetDelegateForFunction <FPDF_CloseDocument>("FPDF_CloseDocument"); this.FPDF_ClosePage = _library.GetDelegateForFunction <FPDF_ClosePage>("FPDF_ClosePage"); this.FPDF_CreateNewDocument = _library.GetDelegateForFunction <FPDF_CreateNewDocument>("FPDF_CreateNewDocument"); this.FPDF_GetDocPermissions = _library.GetDelegateForFunction <FPDF_GetDocPermissions>("FPDF_GetDocPermissions"); this.FPDF_GetPageCount = _library.GetDelegateForFunction <FPDF_GetPageCount>("FPDF_GetPageCount"); this.FPDF_GetPageHeight = _library.GetDelegateForFunction <FPDF_GetPageHeight>("FPDF_GetPageHeight"); this.FPDF_GetPageSizeByIndex = _library.GetDelegateForFunction <FPDF_GetPageSizeByIndex>("FPDF_GetPageSizeByIndex"); this.FPDF_GetPageWidth = _library.GetDelegateForFunction <FPDF_GetPageWidth>("FPDF_GetPageWidth"); this.FPDF_ImportPages = _library.GetDelegateForFunction <FPDF_ImportPages>("FPDF_ImportPages"); this.FPDF_LoadMemDocument = _library.GetDelegateForFunction <FPDF_LoadMemDocument>("FPDF_LoadMemDocument"); this.FPDF_LoadPage = _library.GetDelegateForFunction <FPDF_LoadPage>("FPDF_LoadPage"); this.FPDF_PageToDevice = _library.GetDelegateForFunction <FPDF_PageToDevice>("FPDF_PageToDevice"); this.FPDF_Release = _library.GetDelegateForFunction <FPDF_Release>("FPDF_Release"); this.FPDF_RenderPage = _library.GetDelegateForFunction <FPDF_RenderPage>("FPDF_RenderPage"); this.FPDF_RenderPageBitmap = _library.GetDelegateForFunction <FPDF_RenderPageBitmap>("FPDF_RenderPageBitmap"); this.FPDF_SaveAsCopy = _library.GetDelegateForFunction <FPDF_SaveAsCopy>("FPDF_SaveAsCopy"); this.FPDF_SetFormFieldHighlightAlpha = _library.GetDelegateForFunction <FPDF_SetFormFieldHighlightAlpha>("FPDF_SetFormFieldHighlightAlpha"); this.FPDF_SetFormFieldHighlightColor = _library.GetDelegateForFunction <FPDF_SetFormFieldHighlightColor>("FPDF_SetFormFieldHighlightColor"); this.FPDFAction_GetURIPath = _library.GetDelegateForFunction <FPDFAction_GetURIPath>("FPDFAction_GetURIPath"); this.FPDFBitmap_CreateEx = _library.GetDelegateForFunction <FPDFBitmap_CreateEx>("FPDFBitmap_CreateEx"); this.FPDFBitmap_Destroy = _library.GetDelegateForFunction <FPDFBitmap_Destroy>("FPDFBitmap_Destroy"); this.FPDFBitmap_FillRect = _library.GetDelegateForFunction <FPDFBitmap_FillRect>("FPDFBitmap_FillRect"); this.FPDFDest_GetPageIndex = _library.GetDelegateForFunction <FPDFDest_GetPageIndex>("FPDFDest_GetPageIndex"); this.FPDFDOC_ExitFormFillEnviroument = _library.GetDelegateForFunction <FPDFDOC_ExitFormFillEnviroument>("FPDFDOC_ExitFormFillEnviroument"); this.FPDFDOC_InitFormFillEnvironment = _library.GetDelegateForFunction <FPDFDOC_InitFormFillEnvironment>("FPDFDOC_InitFormFillEnvironment"); this.FPDFLink_Enumerate = _library.GetDelegateForFunction <FPDFLink_Enumerate>("FPDFLink_Enumerate"); this.FPDFLink_GetAction = _library.GetDelegateForFunction <FPDFLink_GetAction>("FPDFLink_GetAction"); this.FPDFLink_GetAnnotRect = _library.GetDelegateForFunction <FPDFLink_GetAnnotRect>("FPDFLink_GetAnnotRect"); this.FPDFLink_GetDest = _library.GetDelegateForFunction <FPDFLink_GetDest>("FPDFLink_GetDest"); //this.FPDFPAGE_AACTION = _library.GetDelegateForFunction<FPDFPAGE_AACTION>("FPDFPAGE_AACTION"); this.FPDFPage_GetMediaBox = _library.GetDelegateForFunction <FPDFPage_GetMediaBox>("FPDFPage_GetMediaBox"); this.FPDFPage_SetMediaBox = _library.GetDelegateForFunction <FPDFPage_SetMediaBox>("FPDFPage_SetMediaBox"); this.FPDFText_ClosePage = _library.GetDelegateForFunction <FPDFText_ClosePage>("FPDFText_ClosePage"); this.FPDFText_FindClose = _library.GetDelegateForFunction <FPDFText_FindClose>("FPDFText_FindClose"); this.FPDFText_FindNext = _library.GetDelegateForFunction <FPDFText_FindNext>("FPDFText_FindNext"); this.FPDFText_FindStart = _library.GetDelegateForFunction <FPDFText_FindStart>("FPDFText_FindStart"); this.FPDFText_GetCharBox = _library.GetDelegateForFunction <FPDFText_GetCharBox>("FPDFText_GetCharBox"); this.FPDFText_GetSchCount = _library.GetDelegateForFunction <FPDFText_GetSchCount>("FPDFText_GetSchCount"); this.FPDFText_GetSchResultIndex = _library.GetDelegateForFunction <FPDFText_GetSchResultIndex>("FPDFText_GetSchResultIndex"); this.FPDFText_GetText = _library.GetDelegateForFunction <FPDFText_GetText>("FPDFText_GetText"); this.FPDFText_LoadPage = _library.GetDelegateForFunction <FPDFText_LoadPage>("FPDFText_LoadPage"); }