Using g_curlInterface in a .vis
#1
Hi, I'm a newbie here and am humbly asking for a helping hand. I'm trying to make a .vis that interacts with Philips Hue lights instead of the screen. Right now I am stuck on how to send and receive http packets within the architecture of the c++ vis api. I see that there's a global object named g_curlInterface that I'd like to use, but I have the following compile errors when I try to build the project. I'm testing this with waveform.vis in win32 for now.

Code:
Error    5    error LNK2019: unresolved external symbol "public: __thiscall DllDynamic::DllDynamic(class CStdStr<char> const &)" (??0DllDynamic@@QAE@ABV?$CStdStr@D@@@Z) referenced in function "public: __thiscall XCURL::DllLibCurl::DllLibCurl(void)" (??0DllLibCurl@XCURL@@QAE@XZ)    C:\xbmc\xbmc\visualizations\WaveForm\Main.obj    visWaveform
Error    6    error LNK2019: unresolved external symbol "public: virtual __thiscall DllDynamic::~DllDynamic(void)" (??1DllDynamic@@UAE@XZ) referenced in function "public: virtual __thiscall XCURL::DllLibCurl::~DllLibCurl(void)" (??1DllLibCurl@XCURL@@UAE@XZ)    C:\xbmc\xbmc\visualizations\WaveForm\Main.obj    visWaveform
Error    7    error LNK2001: unresolved external symbol "public: virtual bool __thiscall DllDynamic::Load(void)" (?Load@DllDynamic@@UAE_NXZ)    C:\xbmc\xbmc\visualizations\WaveForm\Main.obj    visWaveform
Error    8    error LNK2001: unresolved external symbol "public: virtual void __thiscall DllDynamic::Unload(void)" (?Unload@DllDynamic@@UAEXXZ)    C:\xbmc\xbmc\visualizations\WaveForm\Main.obj    visWaveform
Error    9    error LNK2001: unresolved external symbol "public: virtual void * __thiscall XCURL::DllLibCurlGlobal::easy_duphandle(void *)" (?easy_duphandle@DllLibCurlGlobal@XCURL@@UAEPAXPAX@Z)    C:\xbmc\xbmc\visualizations\WaveForm\Main.obj    visWaveform
Error    10    error LNK2001: unresolved external symbol "public: virtual bool __thiscall XCURL::DllLibCurlGlobal::Load(void)" (?Load@DllLibCurlGlobal@XCURL@@UAE_NXZ)    C:\xbmc\xbmc\visualizations\WaveForm\Main.obj    visWaveform
Error    11    error LNK2001: unresolved external symbol "public: virtual void __thiscall XCURL::DllLibCurlGlobal::Unload(void)" (?Unload@DllLibCurlGlobal@XCURL@@UAEXXZ)    C:\xbmc\xbmc\visualizations\WaveForm\Main.obj    visWaveform

This is what I've added to waveform.vis's Main.cpp:

Code:
#include "filesystem/DllLibCurl.h"
using namespace XCURL;
DllLibCurlGlobal g_curlInterface;

Without those statements waveform.vis builds fine.

Is there a better way to do this? The Philips Hue API uses JSON sent over http. I'm no expert with .cpp so please go easy with me. Thanks!
-Tom
Reply
#2
you are linking a separate binary, accessing symbols from the main xbmc.exe. not gonna work up front. either do lazy linking (delay symbol lookups until runtime), or link the necessary objects (DllDynamic.obj from the looks of it).

that being said, the better solution is to not use app internals, and rather use libcurl directly.
Reply
#3
Thanks! The lights work.. kind of. Would you mind pointing me even closer in the right direction? How do I use the libcurl .lib that Kodi uses? I can't find it anywhere. I do see libcurl.dll in \xbmc\system. I can't wrap my head around how Kodi can be built without a libcurl.lib, but my .vis can't.

Background info: I set it up so I use libcurl directly. For a split second the .vis turns on my lights, but then the .vis stops with an error: "Add-on could not be loaded. An unknown error has occurred. Can't load Dll." But I don't want to load any Dll and obviously I don't need to if I can see the .vis controlling my lights for a moment.

How to you "use libcurl directly"? To "use libcurl directly" I built libcurl from source and in my .vis project I made these two entries in Project Properties->Configuration Properties->Linker->
Additional Dependencies: C:\xbmc\xbmc\visualizations\WaveForm\libcurl\curl-7.39.0\build\Win32\VC12\DLL Release\libcurl.lib
Additional Library Dependencies: C:\xbmc\xbmc\visualizations\WaveForm\libcurl\curl-7.39.0\build\Win32\VC12\DLL Release

Thanks!
Reply
#4
I'm going to ask a different question.
Reply

Logout Mark Read Team Forum Stats Members Help
Using g_curlInterface in a .vis0