I'm new to Visual C++, .NET, and the Windows world of programming (coming from Objective-C/Cocoa), and I'm trying to use the CFLite (Open CoreFoundation Lite) library, which I compiled to a .lib file. It's written in pure, unmanaged C, and I'd like to use it in my managed CLR .NET app. When I try to link it and use the function CFSTR, which is a shortcut for __CFStringMakeConstantString, it fails horribly. Any advice? Attached is the error.
Proj.obj : error LNK2031: unable to generate p/invoke for "extern "C" struct __CFString const * __clrcall __CFStringMakeConstantString(char const *)" (?__CFStringMakeConstantString@@$$J0YMPBU__CFString@@PBD@Z); calling convention missing in metadata
Proj.obj : warning LNK4248: unresolved typeref token (01000016) for '__CFString'; image may not run
Proj.obj : error LNK2028: unresolved token (0A00000B) "extern "C" struct __CFString const * __clrcall __CFStringMakeConstantString(char const *)" (?__CFStringMakeConstantString@@$$J0YMPBU__CFString@@PBD@Z) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main@@$$HYMHP$01AP$AAVString@System@@@Z)
Proj.obj : error LNK2019: unresolved external symbol "extern "C" struct __CFString const * __clrcall __CFStringMakeConstantString(char const *)" (?__CFStringMakeConstantString@@$$J0YMPBU__CFString@@PBD@Z) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main@@$$HYMHP$01AP$AAVString@System@@@Z)
UPDATE: I ended up just going with a native application with Win32 calls, since my user interface is going to be minimal anyway (it's a background app). I played around with p/invoke a little, and it just seemed to complicated for a newbie like me :p Thanks!