| | |
DLL and Application
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Nov 2007
Posts: 290
Reputation:
Solved Threads: 7
•
•
•
•
Did you create a DLL project when you got to the window that listed all the different project types? I did, then tried to compile what Dev-C++ generated and got an error that the linker can not find dllcrt0.o even though its in the lib directory. I'm trying to find the solution to this problem.
You are like my right hand.
•
•
Join Date: Nov 2007
Posts: 290
Reputation:
Solved Threads: 7
Hi ,
i discovered why did't work you and me with Dev-C++,because you and i have
Include linking wich it can't bedone in such small programs.
Project option->files->cdll.c
turn off include linking.But i findout it in the other turtorial http://www.apitalk.com/document.php?id=1184209001_1
i discovered why did't work you and me with Dev-C++,because you and i have
Include linking wich it can't bedone in such small programs.
Project option->files->cdll.c
turn off include linking.But i findout it in the other turtorial http://www.apitalk.com/document.php?id=1184209001_1
Last edited by kv79; Dec 21st, 2007 at 6:57 am.
•
•
Join Date: Nov 2007
Posts: 290
Reputation:
Solved Threads: 7
Hi, i created my dll and i call it myfile.dll
And i open Win32 clean project and put these files and it doesend work why?
And i open Win32 clean project and put these files and it doesend work why?
C++ Syntax (Toggle Plain Text)
#include <windows.h> typedef void (*function1_ptr) (); function1_ptr function1=NULL; int APIENTRY WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { HMODULE myDll = LoadLibrary("myfile.dll"); if(myDll) function1 = (function1_ptr) GetProcAddress(myDll,"function1"); if(function1) function1(); FreeLibrary(myDll); return 0; }
What did not work ?
LoadLibrary
GetProcAddress
function1()
or
FreeLibrary ?
If LoadLibrary did not work, look in keep dll in the same folder of exe.
if GetProcAddress did not work
try dumpbin -exports <path>\myfile.dll in command prompt of visual studio to check if function1 is exported from the dll. Make sure you give right path of the dll.
if function1 did not work see your implimentation.
if FreeLibrary did not work, don't worry anyways yopu are ending your application.
LoadLibrary
GetProcAddress
function1()
or
FreeLibrary ?
If LoadLibrary did not work, look in keep dll in the same folder of exe.
if GetProcAddress did not work
try dumpbin -exports <path>\myfile.dll in command prompt of visual studio to check if function1 is exported from the dll. Make sure you give right path of the dll.
if function1 did not work see your implimentation.
if FreeLibrary did not work, don't worry anyways yopu are ending your application.
I know I am. Therefore I am.
•
•
Join Date: Nov 2007
Posts: 290
Reputation:
Solved Threads: 7
Hi , i use Dev-C++
That file working but not right because he must put my MessageBox on the screen Here is myfile.dll
Thank you for your effort of reading.
That file working but not right because he must put my MessageBox on the screen Here is myfile.dll
C++ Syntax (Toggle Plain Text)
#include <windows.h> extern "C" { //functions callable in dll void __declspec (dllexport) function1() { MessageBox (NULL, "test message","test title",0); } } BOOL WINAPI DllMain (HINSTANCE, DWORD, LPVOID) { return TRUE; }
Thank you for your effort of reading.
Last edited by kv79; Dec 21st, 2007 at 11:25 am.
I don't use LoadLibrary() for most DLLs that I write. Instead, I just use __dllimport and prototype it in the *.c or *.cpp application program, then link with the *.lib file that the compiler generated when the DLL was compiled and linked. But of course if you don't have a *.lib file then this method will not work.
C++ Syntax (Toggle Plain Text)
// prototype the function that is in the DLL void __declspec (dlimport) function1(); int main() { function1(); // call the function in the DLL return 0; }
Last edited by Ancient Dragon; Dec 21st, 2007 at 12:00 pm.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
There is should ne bo reason why MessageBox should fail provided you make that call and system is not running out of handles.
change your implimentation as shown above and get the error code.
C++ Syntax (Toggle Plain Text)
int __declspec (dllexport) function1() { if(IDOK != MessageBox (NULL, "test message","test title",MB_OK)) { DWORD dw = GetLastError(); return dw; } return 0; }
change your implimentation as shown above and get the error code.
Last edited by dubeyprateek; Dec 21st, 2007 at 12:22 pm. Reason: adding MB_OK insted of IDOK
I know I am. Therefore I am.
.lib is always created once you create a dll. You can include that .lib in linker options of your project then you dont need to call LoadLibrary. it is static linking of dll.
However, your implimentation is right if all the API calls are working and function() is exported(it is exported) you should see MessageBox.
Please change the implimentation and get me the error code.
However, your implimentation is right if all the API calls are working and function() is exported(it is exported) you should see MessageBox.
Please change the implimentation and get me the error code.
I know I am. Therefore I am.
![]() |
Similar Threads
- How Do I . . . Make a Class Accessible from a DLL (C++)
- Console application and MFC-DLL application (C++)
- Localization application (C++)
- DLL in C For Vbasic (Visual Basic 4 / 5 / 6)
- static and dynamic Dll (C++)
- Export Obejct from DLL (C++)
- How to use interface of a dll which is developed in C#>NET in my VC++.NET appli (C++)
- Faulting application msimn.exe (Windows NT / 2000 / XP)
Other Threads in the C++ Forum
- Previous Thread: Help reading/writing to text files...
- Next Thread: Read a text file
Views: 2766 | Replies: 29
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api array arrays beginner binary bmp c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll download dynamic encryption error file forms fstream function functions game givemetehcodez google graph gui iamthwee ifstream input int java lib library lines linkedlist linker loop looping loops map math matrix memory microsoft newbie news number output pointer problem program programming project python random read recursion recursive reference return sort stream string strings struct studio system temperature template templates test text text-file tree unix url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets






