Forums: 

Hello,

I have two projects: one for C# and another for C.  In both cases, I am trying to get the musicid_lookup_album_toc sample code to run:

  • In the C# project I am using gnsdk\wrappers\gnsdk_csharp\src_wrapper and gnsdk\wrappers\gnsdk_csharp\samples\musicid_lookup_album_toc\MusicIDLookupAlbumTOC.cs
  • In the C project I am using gnsdk\samples\musicid_lookup_album_toc\main.c

I have registerd an App Name under the GraceNote Developer Program; and both of my projects have command line arguments which specify the Client ID, the Client Tag and the License File.

In the case of the C# project, I encounter the following exception when the SDK is Initialized at Line 338 of MusicIDLookupAlbumTOC.cs:

System.TypeInitializationException occurred
  HResult=0x80131534
  Message=The type initializer for 'GracenoteSDK.gnsdk_csharp_marshalPINVOKE' threw an exception.
  Source=gnsdk_csharp
  StackTrace:
   at GracenoteSDK.gnsdk_csharp_marshalPINVOKE.new_GnManager(String jarg1, String jarg2, Int32 jarg3)
   at GracenoteSDK.GnManager..ctor(String gnsdkLibraryPath, String license, GnLicenseInputMode licenseInputMode) in C:\Users\dictionary\Documents\Visual Studio 2017\Projects\gnsdk_csharp\gnsdk_csharp\GnManager.cs:line 152
   at Sample.MusicIDLookupAlbumTOC.Main(String[] args) in C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc_wrapper\musicid_lookup_album_toc_wrapper\MusicIDLookupAlbumTOC.cs:line 338

Inner Exception 1:
TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception.

Inner Exception 2:
DllNotFoundException:
Unable to load DLL 'gnsdk_csharp_marshal': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

In the case of my C project, I modified the Linker "Additional Link Libraries" setting to point to gnsdk\lib\win_x86-64, However, I encounter the following LNK2019 errors listed below.  It is as if the .lib and .dll libraries cannot be found.  Any suggestions will be appreciated.

Thank you!

Severity

Code

Description

Project

File

Line

Suppression State

Error

LNK2019

unresolved external symbol gnsdk_manager_error_info referenced in function _display_last_error

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_manager_initialize referenced in function _init_gnsdk

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_manager_shutdown referenced in function _shutdown_gnsdk

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_manager_get_product_version referenced in function _display_gnsdk_product_info

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_manager_get_build_date referenced in function _display_gnsdk_product_info

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_manager_string_free referenced in function _display_local_db_info

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_manager_user_register referenced in function _get_user_handle

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_manager_user_create referenced in function _get_user_handle

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_manager_user_is_localonly referenced in function _get_user_handle

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_manager_user_release referenced in function _get_user_handle

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_manager_user_option_set referenced in function _init_gnsdk

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_manager_locale_load referenced in function _set_locale

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_manager_locale_set_group_default referenced in function _set_locale

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_manager_locale_release referenced in function _set_locale

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_manager_gdo_value_get referenced in function display_album_gdo

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_manager_gdo_child_count referenced in function display_for_resolve

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_manager_gdo_child_get referenced in function display_album_gdo

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_manager_gdo_render referenced in function _display_local_db_info

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_manager_gdo_release referenced in function _display_local_db_info

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_manager_logging_enable referenced in function _enable_logging

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_manager_storage_location_set referenced in function _set_locale

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_config_create referenced in function _open_local_db

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_config_release referenced in function _open_local_db

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_config_value_set referenced in function _open_local_db

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_lookupdatabase_open referenced in function _open_local_db

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_lookupdatabase_info_get referenced in function _display_local_db_info

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_musicid_initialize referenced in function _init_gnsdk

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_musicid_query_create referenced in function query_album_lookup

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_musicid_query_release referenced in function query_album_lookup

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_musicid_query_set_toc_string referenced in function query_album_lookup

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_musicid_query_set_gdo referenced in function query_album_lookup

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_musicid_query_find_albums referenced in function query_album_lookup

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_storage_sqlite_initialize referenced in function _init_gnsdk

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK2019

unresolved external symbol gnsdk_lookup_local_initialize referenced in function _init_gnsdk

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\musicid_lookup_album_toc\main.obj

1

 

Error

LNK1120

34 unresolved externals

musicid_lookup_album_toc

C:\Users\dictionary\Documents\Visual Studio 2017\Projects\musicid_lookup_album_toc\x64\Debug\musicid_lookup_album_toc.exe

1

 

I have managed to the second C Project working.  Besides identifying the gnsdk\lib\win_x86-64 folder under Linker > General > Additional Library Directories, one must also list the individual .lib files under Linker > Input > Additional Dependencies; and the DLL's must be copied into the bin folder.

Perhaps the DLL load issue with the first C# project has a similar cause...

In the case of the first C# Project:

  • One must add a Reference to gnsdk\wrappers\gnsdk_csharp\lib\gnsdk_csharp.dll.
  • A Post-build event should be added to copy gnsdk\wrappers\gnsdk_csharp\lib\win_x86-64\gnsdk_csharp_marshal.dll into the Output Directory.
  • The gnsdk\lib\win_x86-64 folder must also be passed in via the command line; so the gnsdk_loader can load modules such as gnsdk_manager.dll.

"The gnsdk\lib\win_x86-64 folder must also be passed in via the command line; so the gnsdk_loader can load modules such as gnsdk_manager.dll."

How are you passing in the folder via command line?

 

 

Forum Discussions