IPB

Welcome Guest ( Log In | Register )

> foobar2000 Development Forum Rules

This forum is for developer discussions only. If you have a problem / bug report / idea / feature request that isn't related to foobar2000 SDK, post it in an appropiate forum instead - tech support questions go to support forum, everything else goes to general forum.
All non-developer posts on this forum will be removed. Continued abuse of this forum will result in admin actions (warnings, account suspension).

 
Reply to this topicStart new topic
Having problems implementing cURL
damrass
post Jan 3 2010, 18:28
Post #1





Group: Members
Posts: 11
Joined: 3-January 10
Member No.: 76621



I have it working in the Winamp version of my plugin, but my foobar version is throwing all kinds of weird link errors at me when building. Here are a few:

CODE
1>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _calloc already defined in LIBCMTD.lib(dbgcalloc.obj)
1>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _realloc already defined in LIBCMTD.lib(dbgrealloc.obj)
1>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _free already defined in LIBCMTD.lib(dbgfree.obj)
1>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _malloc already defined in LIBCMTD.lib(dbgmalloc.obj)


I'm using the static version of the cURL library which I myself built from the sources. In case I'm missing something, here are my Compile and Linker command-lines respectively:

CODE
/Od /I "C:\Documents and Settings\Jonathon\Desktop\beenplaying\libcurl\include" /I "C:\Documents and Settings\Jonathon\Desktop\SDK-2008-11-29\foobar2000" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "BEENPLAYING_EXPORTS" /D "CURL_STATICLIB" /D "_WINDLL" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /MTd /Fo"Debug\\" /Fd"Debug\vc90.pdb" /W3 /nologo /c /ZI /TP /errorReport:prompt


CODE
/OUT:"C:\Documents and Settings\Jonathon\Desktop\SDK-2008-11-29\Debug\foo_BeenPlaying.dll" /INCREMENTAL /NOLOGO /LIBPATH:"C:\Documents and Settings\Jonathon\Desktop\beenplaying\libcurl\lib\Debug" /LIBPATH:"C:\Documents and Settings\Jonathon\Desktop\SDK-2008-11-29\foobar2000\shared" /DLL /MANIFEST /MANIFESTFILE:"Debug\foo_BeenPlaying.dll.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\Documents and Settings\Jonathon\Desktop\SDK-2008-11-29\Debug\foo_BeenPlaying.pdb" /SUBSYSTEM:WINDOWS /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:PROMPT shared.lib shlwapi.lib libcurl.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib "..\..\foobar2000\foobar2000_component_client\debug\foobar2000_component_client.lib" "..\..\debug\pfc.lib" "..\..\debug\foobar2000_sdk_helpers.lib" "..\..\foobar2000\sdk\debug\foobar2000_sdk.lib"


Any help whatsoever would be greatly appreciated. I've been scouring the web for the last few hours trying to find a solution. If you think it'll help, let me know and I'll post the command-lines for my Winamp plugin project.
Go to the top of the page
+Quote Post
Zao
post Jan 3 2010, 18:39
Post #2





Group: Members (Donating)
Posts: 910
Joined: 25-September 03
From: Umeň, Sweden
Member No.: 9001



Ensure that you are using the same CRT runtime DLL setting in VC++ for both your component and your libraries. (Project Properties -> C/C++ -> Code Generation -> Runtime Library.)
Personally I tend to go with the non-DLL debug/release one for foobar2000 components to avoid having to redistribute the runtime redist, which virtually no user seems to be able to install correctly.


--------------------
Zao shang yong zao nong zao rang zao ren zao.
To, early in the morning, use a chisel to build a bathtub makes impatient people hot-tempered.
Go to the top of the page
+Quote Post
damrass
post Jan 3 2010, 18:47
Post #3





Group: Members
Posts: 11
Joined: 3-January 10
Member No.: 76621



Well I got it to build moments before you posted Zao! (Don't you hate it when you figure something out shortly after posting for help online??)

To fix it, I went to the Linker Input section of the Config, and
  • Added "libcmtd" to Ignore Specific Library
  • Added "ws2_32.lib" to Additional Dependencies (had it in my Winamp plugin project, forgot to add it here... d'oh!)


But I'll definitely take that into consideration though Zao, as I realized I was having problems running my Winamp plugin on other people's machines. Thanks!

Edit: Actually, now that I think about it... I set all my components and libraries to MTd (or MT for release). I prefer statically-linking for the same dependency nightmares you mention.

Edit 2: Actually, now that I went and looked for sure I was using MDd for both my Winamp plugin project and for the cURL library project. I'll try recompiling cURL with MTd, and see if that works. Thanks again.

This post has been edited by damrass: Jan 3 2010, 18:54
Go to the top of the page
+Quote Post
Zao
post Jan 3 2010, 18:55
Post #4





Group: Members (Donating)
Posts: 910
Joined: 25-September 03
From: Umeň, Sweden
Member No.: 9001



For normal code, I wouldn't dream of linking statically to the runtime as that would prevent me from using the standard C++ library across DLL boundaries, but in an environment like foobar2000 where the pfc and services bits exist, multi-DLL development with a static runtime is feasible.


--------------------
Zao shang yong zao nong zao rang zao ren zao.
To, early in the morning, use a chisel to build a bathtub makes impatient people hot-tempered.
Go to the top of the page
+Quote Post
damrass
post Jan 3 2010, 19:06
Post #5





Group: Members
Posts: 11
Joined: 3-January 10
Member No.: 76621



QUOTE (Zao @ Jan 3 2010, 11:55) *
For normal code, I wouldn't dream of linking statically to the runtime as that would prevent me from using the standard C++ library across DLL boundaries, but in an environment like foobar2000 where the pfc and services bits exist, multi-DLL development with a static runtime is feasible.


Hmm, I bet that's why I had set my Winamp project and the cURL library to link dynamically; I think I recall it not being able to build when statically-linked. (Now if I could just figure out why that stupid thing crashes on other machines I'd be keen, but I suppose that discussion isn't relevant here.)

Thanks for being patient to an old C++ programmer that hasn't seriously looked at the code in over 10 years. I'm relearning all the nuances all over again.
Go to the top of the page
+Quote Post
damrass
post Jan 3 2010, 19:17
Post #6





Group: Members
Posts: 11
Joined: 3-January 10
Member No.: 76621



So I rebuilt cURL to link statically and then removed libcmtd from Ignore Specific Library that I added in my previous post, and of course you were right--it built fine.

One question though... the original "fix" I posted above, would that have caused any harm (having libcmtd ignored)? It didn't seem to affect *my* plugin's behavior, but I'm just curious if it would or could have caused problems for foobar or the other installed plugins.
Go to the top of the page
+Quote Post
Zao
post Jan 3 2010, 19:21
Post #7





Group: Members (Donating)
Posts: 910
Joined: 25-September 03
From: Umeň, Sweden
Member No.: 9001



I'm not quite sure, but I believe it wouldn't matter too much in the case of dynamic vs. static runtime. The scary scenario would be if you tried to mix debug and release runtimes, resulting in lovely ODR violations, if you could even get it to link at all.


--------------------
Zao shang yong zao nong zao rang zao ren zao.
To, early in the morning, use a chisel to build a bathtub makes impatient people hot-tempered.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 26th October 2014 - 00:33