Jump to content
  • Advertisement
Sign in to follow this  
garyfletcher

DLL hangs SDL_main(). (SOLVED) - thanks for all the help.

This topic is 4868 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've created a dll with DEV-C++ now I'm a little confused as to where I need to put it to use it. I've put the .a in the same place as my SDL*.a files and I've tried doing the same with the .dll but I'm still getting linker errors while compiling the project. Any ideas? [Edited by - garyfletcher on June 22, 2005 2:38:38 PM]

Share this post


Link to post
Share on other sites
Advertisement
Not positive if it's the same as in Visual Studio, but ussually you just put in in the same directory as the project (at the highest level). Or (if you're running windows), putting it in your Win32 folder should work as well. Although, that's probably not the best idea, since you'll probably want to distribute the DLL with the exe.

Matt Hughson

Share this post


Link to post
Share on other sites
I am not sure about Dev C++ , but for the little experiment i had done with dll's , in vc++ 6 , you need to have the dll in your project folder.I am not sure about putting it in win32 , may be you need to register the dll if you put it there.Hope this helps. =)

Share this post


Link to post
Share on other sites
Well, I don't know if this is the correct way to do things, but I think if you add the dll to the list of things being linked then it will work (as in the dll won't become part of the executable but and needs to be in the same directory as the exe for it to run). Dev-Cpp uses a port of g++ as its compiler\linker, and I seem to remember this working when I tried it with g++.

Share this post


Link to post
Share on other sites
You need to place the .a file for your library in the lib subdiretory of your Dev-C++ installation directory, you only need the .a file in there and not the .dll. Now the library is where the linker can find it you need to link to it. If your library was called libMyDll.a then you would need to add -lMyDll to the linker command line.

Then place the .dll inside the directory where the resulting .exe file is so you can run the program and you should be all set to go.

Share this post


Link to post
Share on other sites
Spudder has it right. My advise, though, would be to ditch Dev-C++ completely and just use Visual Studio. It's a much better IDE and gives you features that Dev-C++ doesn't provide. You might also want to try out C#, very nice language.

Share this post


Link to post
Share on other sites
Just my 2 cents. I would not get MSVC, though, I would ditch dev-c++. Instead, I would go for Code::Blocks, a much better IDE then Dev-c++. It supports multiple projects simultaneously, and has plugins for compilers... So, you can use the MinGW compiler or use the free C++ .net Compiler that Microsoft provides.

I havn't tried it on Linux, but I'm pretty sure it works there too (using gcc).

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
after compiling the dll, you should have a .dll and .lib file

(example mydll.dll and mydll.lib)

Next you need to create a header file to use the dll with your project:

#ifndef _mydll_h_
#define _mydll_h_

#pragma comment(lib, "mydll.lib");

//The functions in the dll file
__declspec(dllimport)functionA();
__declspec(dllimport)functionB();

#endif

this will be included in the project that uses the dll. then compile the project and you should be able to use your dll file.

That how I create and load my dll files

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!