Click here to Skip to main content
15,917,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,

I have a solution that has two projects in it. One project is the game engine, which is a DLL. The other project is an application which is supposed to use the game engine.

I'm trying to test some of the functions I've coded into the engine in the application, and I've added the necessary include directories to the project, but when I build the solution VS complains about unresolved externals, which are all in the game engine.

/Edit: How do I make VS output a .lib file for the DLL project? I'll be able to solve this problem if there's a .lib file.

Thanks in advance!
Posted
Updated 15-Apr-12 12:39pm
v2

Have you tried setting the dll project as a dependency to the application? If you configure it that way, the dll project should compile first and create any products related to that project before compiling the .exe. That should get you what you need.
 
Share this answer
 
Comments
Member 7887373 16-Apr-12 18:30pm    
I have set the DLL project as a dependency to the application, it complains about unresolved externals. This is quite frustrating. Note in case I haven't made clear, I'm using Visual Studio 2010.
Albert Holguin 16-Apr-12 19:07pm    
Which project is complaining about the unresolved externals? The exe? Remember that you have to explicitly tell the linker that there's a dependency on the .lib file that was generated by the other project.
Albert Holguin 16-Apr-12 19:08pm    
...and try to take a deep breath... everything works out in the end... :D ...I've had a pretty frustrating day as well...
Without a .lib file it's going to be hard work. You can load the DLL from your application with a call to LoadLibrary. Then you have to ask for a function pointer of each of the functions you want to use with calls to GetProcAddress. Via the function pointers you can then call the functions of your DLL.

If the DLL contains C++ class objects, you probably need only to ask for the functions that create such objects. Then use the .h file with the class definitions to call the functions of such classes (which all need to be virtual functions). That way, the number of functions you need to ask for via GetProcAddress is relatively small.

Before getting started on this you might want to check whether there is really no .lib file available for your game engine DLL.
 
Share this answer
 
Comments
Member 7887373 15-Apr-12 18:13pm    
I figured it would be difficult. The question is, how do I make VS output a .lib file? All it is generating is the DLL which is less than useful without the .lib.
nv3 16-Apr-12 2:18am    
If you are building the DLL from sources the linker should generate a .lib file. Look how the linker output options are set in the properties of the DLL project. That should tell you where the .lib file goes. Perhaps you were simply looking in the wrong place.

If you only have a ready made DLL, there is no simple way how to recreate the corresponding .lib file from it.
You can try to follow the procedure outlined here:
How To Create 32-bit Import Libraries Without .OBJs or Source[^]


Best regards
Espen Harlinn
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900