Archived

This topic is now archived and is closed to further replies.

jollyjeffers

Getting DLL's to work with VC++

Recommended Posts

Hello all, This is somewhat related to my other post just now... BUT I''ll split the two questions up for clarity I''ve managed to create a windows .dll for an engine class, which is compiled fine, and exported to a plain .exe. The .exe just needs the header file and to know the location of the .lib file that goes with the .dll. But thats the problem. I want to make a fairly clean division between the seperate modules and the core game code - by using a simple folder structure can''t be too much to ask! \MyGame [Executable and project code] ...\Engines ...\...\Graphics [.DLL, .lib, .h and project code] ...\...\Audio [.DLL, .lib, .h and project code] Now, thing is, I can''t get either windows or VC++ to see anything but the .h file (done using #include "Engines\Graphics\CGraphics.h") I found a way to get VC++ to see the .lib file (and hence compile), by setting the program options, but I don''t like that - I want something at the project level. I don''t want to rely on every programmer tweaking their VC++ settings (unless that is the only way to do it). Next up, so i get it compiling, but unless the .dll is in the same folder as the .exe it won''t run.. Fair enough, I suppose I can work with that limitation - but it''d be nice to have the engine-DLL''s in a sub folder... So, any chance any of you could confirm/correct the following: 1. Is it possible to structure a large project over several folders like this? 2. How can I get VC++.Net2002 to "include" a .lib file from a sub-folder WITHOUT changing the core program settings? 3. To use a DLL thats loaded statically / compile-time, do I really need to import it''s ".h" file into the host project for VC++ to recognise it? Any help is greatly appreciated! cheers, Jack

Share this post


Link to post
Share on other sites
Add the line:

#pragma comment (lib, "yourlibname.lib")

after your header file, alternatively you could do it within your header file at the very end.

Regards ZedFx

...

Share this post


Link to post
Share on other sites
quote:
#pragma comment (lib, "yourlibname.lib")


ahhhh, sounds clever I''ll go test it in a second, but hopefully It''ll allow "Folder\subfolder\yourlibname.lib" type constructions...

thanks for the tip ZedFx. Appreciated.

Jack

Share this post


Link to post
Share on other sites