Majid L

Hi all,
I have project with two dsp. one of them(mylib) is a Win32 Dynamic Link Librarry and other(caller) is Win32 Console Application and call a function in that dll (void test()) . I set caller's dependency to mylib but after compile and linking I get this error:
LINK : fatal error LNK1104: cannot open file "\C++\Project\VC\TestDLL\MyLib\Debug\MyLib.lib"
Error executing link.exe.

I check log4cplus project(they use one dll dsp and some examples dsp which use that dll) and see that they create a lib and dll file together(log4cplus.lib and log4cplus.dll). They use log4cplus.lib file from the examples and it seems that lib file is juse a interface for log4cpluse.dll and the dll is load from run time, I am wonder if there is way that I can do the same (produce a lib and dll file in my project together).



Re: Visual C++ General Using dll in dsp file.

Simple Samples

Majid L wrote:
Hi all,
LINK : fatal error LNK1104: cannot open file "\C++\Project\VC\TestDLL\MyLib\Debug\MyLib.lib"
Error executing link.exe.

Does that file exist Note that there is an extra backslash as the first character of the path and filename; if that extra backslash is actually there in the path then of course the file does not exist.

Majid L wrote:
I check log4cplus project(they use one dll dsp and some examples dsp which use that dll) and see that they create a lib and dll file together(log4cplus.lib and log4cplus.dll). They use log4cplus.lib file from the examples and it seems that lib file is juse a interface for log4cpluse.dll and the dll is load from run time, I am wonder if there is way that I can do the same (produce a lib and dll file in my project together).

A lib file is always created when a dll file is created unless there is nothing to put into a lib file. A dll file is never used during the build, only during execution. A lib file is never used during execution, only during the build.






Re: Visual C++ General Using dll in dsp file.

Majid L

Thanks for your reply,
>>Does that file exist Note that there is an extra backslash as the first character of the path and filename; if that extra backslash is actually there in the path then of course the file does not exist.
When a file address is start with "\" it means that this address start from root of active drive, so you can think of that address as a F:\C++\Project\VC\TestDLL\MyLib\Debug\MyLib.lib where F: is the drive where my project is located.
By the way, MyLib.lib wasn't created and only MyLib.dll was created.
>>A lib file is always created when a dll file is created unless there is nothing to put into a lib file.
Yes, the point is it. I don't export any symbole so no lib file is created. In log4cplus all classes are added to dll without andy explicit code (like BOOL APIENTRY DllMain). Do you know what should I do to add all my classes and functionts in my code to dll and lib files






Re: Visual C++ General Using dll in dsp file.

Majid L

Yes you are right,
I made a mistak. in the log4cplus project, developer use a #define which I didn't notice,

#ifdef LOG4CPLUS_STATIC
# define LOG4CPLUS_EXPORT
#else
# ifdef LOG4CPLUS_BUILD_DLL
# define LOG4CPLUS_EXPORT __declspec(dllexport)
# else
# define LOG4CPLUS_EXPORT __declspec(dllimport)
# endif
#endif

they use LOG4CPLUS_EXPORT befor each class they want to export to dll.
Thanks for your help




Re: Visual C++ General Using dll in dsp file.

Simple Samples

Majid L wrote:
When a file address is start with "\" it means that this address start from root of active drive, so you can think of that address as a F:\C++\Project\VC\TestDLL\MyLib\Debug\MyLib.lib where F: is the drive where my project is located.

Sorry about that. Thankfully you understand.