I am using code::blocks and have written a dll. I am currently testing it but am getting tired of having to compile it, copy the DLL, DEF, H and A files into a test project, and then compiling the test project every time I need to fix something. Is there any easier way to test a DLL?

Recommended Answers

All 6 Replies

The only file you need in the test project folder is the *.dll. Actually, you can put it any of the folders listed in your PATH environment variable, such as c:\windows\system. As for the *.h file(s), just put the full path to where they are located in the include statement, e.g. #include "c:\mydir\test.h" Application programs do not need any of the other files you mentioned.

Usually, you can put it any of the folders listed in your PATH environment variable, such as c:\windows\system. Af for the *.h file(s), just put the full path to where they are located in the include statement, e.g. #include "c:\mydir\test.h" Application programs do not need any of the other files you mentioned.

The problem is that I tried that and I got a ton of link errors! I know that that method worked for two other DLLs I made (one for random numbers, one for infinite math) I feel like I did something wrong in this DLL project's settings.

Did you link with the *.lib file that was generated when you compiled the *.dll?

Yes, although my compiler called it MyDLLName.DLL.a I only get the link errors on some seemingly arbitrary functions. The link error I get looks like:
undefined reference to '_imp__LABglClose@4'

Check the *.def file to make sure you exported that function.

Aha! For some weird reason the default setting was for debug builds to NOT create .a files, so I was using files from my last Release build, which was incomplete.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.