Does your DLL project have any actual exports? If there are no exports, the linker will not generate an import library .lib file.
In the non-Express version of VS, the import libray name is specfied in the project settings here:
Configuration Properties/Linker/Advanced/Import Library
I assume it's the same in Express (if it even provides the ability to configure the name).
If you can recompile your lib, just add __declspec(dllexport)
to the signatures of all of the functions you want to be exported.
void __declspec(dllexport) testfun( char* inp_buff, unsigned short* inp_len, char* buffer_decomp,unsigned *output_len,unsigned short *errorCode)
If you can't do that, then you can export them by writing a .def file instead. Using def files you can even change the name of a function as it is exported.
http://msdn.microsoft.com/en-us/library/28d6s79h.aspx
---- contents of mylib.def ----
LIBRARY
EXPORTS
testfun
newname=testfun2
Then when you link the dll, include mylib.def
link /dll /machine:x86 /def:mylib.def mylib.lib
Edit2:
note that pinvoke assumes that the functions you import will have _stdcall calling convention unless you say otherwise. So you might need to do this as well, in your C# code.
[DllImport("mylib.dll", CallingConvention=CallingConvention.Cdecl)]
Or, you could change your C++ code to be __stdcall
void __declspec(dllexport) __stdcall testfun( char* inp_buff, ...
Best Answer
The way I've done this, and this may not be the "best" way, was to create a new project with the right settings (DLL in this case) and then create the stub methods with the wizards that I want to expose from the static library.
Then you have two choices, you can leave the real code in the static library and just have your stubs in the DLL call into the static library, or you can copy the code out of the static library project and retire the static library entirely.
The advantage of the first option is that you can support both the static library and the DLL without having to duplicate a lot of work. But if you can get rid of supporting the static library entirely the second option is probably better because you don't have to make changes in two different projects (adding the stub method in the DLL and the real code to the static lib) every time you want to add a new method/property. YMMV