Jump to content
  • Advertisement


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


Will not build .exe for dll import

This topic is 5815 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have two projects...one that exports the dll, and the other that imports the dll. I only need the executable for the import. The export builds the dll and the lib. I put the dll in the same directory that the import executable would be, and I put the .lib in the lib directory of vc98. For some reason the executable of the import project isn''t being built and I''m not sure how to make msvc++ build the damn thing. I am pretty sure that the code I have created is fine (it compiles and is simple). Someone help moi What do you mean ''''Someday become a programmer?'''' I''''m a programmer right now!

Share this post

Link to post
Share on other sites
If this is in a workspace you simply make the .exe project dependent upon the dll project.

This sets up the linker to do the right thing with the import library.

You shouldn't have to worry about where to put the .lib file

So long as the exe and dll projects both have the same intermediate and final output directories it will be ok.

BTW - to do this go to Project->Dependencies

In the combo box you should select your exe project. In the list box underneath it put a check next to your dll project

[edited by - SteveC on August 15, 2002 12:23:02 PM]

Share this post

Link to post
Share on other sites
I'm not sure if this is the solution to your problem, so if anyone can back me on this, please do.

I think you just need to set the dependencies for the .dll file. Select the project for your .dll and select Dependencies in the Project menu. There, you should make sure you have the project for you .exe file checked. That way when you build your .dll it will make your .exe first.

I'm probably wrong.... oh well.

(Steve C posted while I was typing. Guess I was right.)

[edited by - Stealth2000 on August 15, 2002 12:26:19 PM]

Share this post

Link to post
Share on other sites
Okay I am confused, when I go to dependecies I didn't get that option...

I am going to scratch this and start over.

When I create a dll, I need a win32 dll project that exports the library and dll. The header file declares the function that is exported to the dll, and then i'll have the source file define the function that is exported to the dll (this is all in the same dll project)

I think my problem was with the second project that actually uses the dll. does it need to be another win32dll app? or do I just create a source file/console project?

And when I actually use the file I have to import the dll using #pragma comment(lib, "library name") correct?
and then call my function from main?

I'm sorry if I'm not making sense
I'm going to try out what I said, but i hope someone will still respond
also where is the dll and lib supposed to be? do I just put the dll in the debug folder of the project that uses the dll function? I can put the .lib in the lib directory, if that is where it is supposed to go.

What do you mean ''Someday become a programmer?'' I'm a programmer right now!

[edited by - Shadow1234567890 on August 15, 2002 1:56:53 PM]

Share this post

Link to post
Share on other sites
Your other project, which uses the DLL, must be either another DLL or an executable.

At some point you need to make an application - eg an .exe

It can be a console or gui app doesn''t matter.

Then you make your .EXE project be dependent upon the DLL project.

Now, I have been assuming that you have properly setup macros in your headers for dllexport and dllimport and have them made in such a way that when you build the DLL the header specifies export and when you build the EXE it specifies import.

There is help in the MSDN stuff on setting up this part of the header files for use in a DLL

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!