Dev-C++ and DLL files
KaBlammyman

Okay, I need to use some functions that are in a DLL file I made in Dev-C++. I don’t know how to link em' together in Dev-C++ as to get rid of the” undefined reference" errors.

Well, if it helps, I'm trying to re-compile the example (in Dev-C++) from this webpage:
http://www.codeproject.com/dll/ParkMouse.asp

The DLL source compiled and made a DLL. :D
The exe will not compile because of linker errors since I am trying to use the functions in the DLL >:(

How can I make Dev-C++ see the functions in the DLL so I can compile the exe?

Thanx

p.s. Google didn’t help...too many people asked this same question and didn’t get straight answers, and the ones who found the answer didn’t share it with the world (or gave a vague description that doesn’t help me)

Hrvoje Ban

When DLL is compiled you'll have two files: <dll name>.dll and lib<dll name>.a file. Link with later.

KaBlammyman

tried that...and i also tried adding the .def file (--def foo.def) and it didnt work.

Any other ideas...or is this something that the developers on dev-c++ messed up on. I'm gonna send them an email. >:(

Johan Halmén

If you link with your .a and it doesn't work, your .a file is bad.

Or you have wrong order in the .a files.

liballeg.a should be the last one. When you choose Project, Project Options, Parameters and look at the Linker window to the right, you see a list of .a files you link with. In this list liballeg.a should be the last one. Or you might have -lalleg there. It is a plain text window with line breaks. Just edit it.

In my present project, my Linker window says:
../../../../../Dev-Cpp/GnuWin32/lib/libpng.a
../../../../../Dev-Cpp/GnuWin32/lib/libz.a
../../../../../Dev-Cpp/lib/libjpgal.a
-lalleg

The funny paths I get when I use the browser behind the "Add Library or Object" button.

KaBlammyman

Im not sure if I understand you correctly...but I'm not using allegro for this particular project. AS I said in the previous thread, I want to compile and run the example from this website:
http://www.codeproject.com/dll/ParkMouse.asp

I didnt modfiy the code, so I dont know how the .a file can be bad.

Marco Radaelli

Post the full command you use to compile the program plus all the errors you get

I'm not registered at codeproject.com, so if you can attach both files to the post, I can give them a look :)

BAF
Marco Radaelli

Thank you :D

Going to give a look at that code :)

KaBlammyman

anybody else tried to run the code?

Marco Radaelli

Sorry I was forgetting about this :)

I tried it, well, it does compile, make the dll and I can make the executable.
When I run it it says 'Hook Failed' but the program works. I have no idea about that.

umperio
Quote:

or is this something that the developers on dev-c++ messed up on. I'm gonna send them an email. >:(

I think before bothering Dev-Cpp developers you should first try to understand where the problem is. I've read some tutorials about dll creation and it seems to me that the code linked is not 100% standard. What I mean is none of the dll functions is exported in a header. So probably the error is just caused by the differences in how mingw (and not dev-cpp) and microsoft compiler manage dlls.
If I were in you I'd try creating a Dll.h file which contains what's written in Exe.h and try to recompile the dll, then include dll.h when compiling the exe.
I didn't try it, since I don't have mingw installed here.

Thread #577369. Printed from Allegro.cc