what is the dll?? how can I make dll in c++?? Can we do everything with dll??
what is the dll?? how can I make dll in c++?? Can we do everything with dll??
http://en.wikipedia.org/wiki/Dynamic-link_library
Depends on your IDE and compiler.
I have simple program.. I wrote it in c++.. its winapi.. can I convert it to dll??
Sory I dont understand.. Sory my english.. and ask one more questions.. how can call or start the dll??
yes I use Microsoft Visual c++ 6.0
That may answer what, but not how.
Create a new project
select either Win32 DLL (VS 6.0 or earlier) or blank project in VS2005+
if VS2005+ go to project properties and change the type from application(exe) to Dll
put _declspec(dllexport) before any varibles ro functions you want to export.
I have Microsoft Visual Studio 2008 full version but if I build my code in 2008 it needs framework if I build in 6.0 it doesnt need framework.. so I use 6.0 sometimes..
No, you don't. You can still write Win32 applications.
Don't use Windows Form projects - those are .net.
Ah yes, I don't have 6.0, so I can't show how in that old version...
That solves only half the problem.put _declspec(dllexport) before any varibles ro functions you want to export.
Better do something such as:
That should ensure you can export and use functions (and classes!) from dlls.Code:#under EXPORT #ifdef DLL #define EXPORT __declspec(dllexport) #else #define EXPORT __declspec(dllimport) #endif EXPORT void myfunc();
It's the first step.
I create it in visual c++ 6.0 and write first part like this :
and I add my codeCode:#under EXPORT #ifdef DLL #define EXPORT __declspec(dllexport) #else #define EXPORT __declspec(dllimport) #endif
I didnt write EXPORT but it didnt get error... yes.. how can I start my program?? :SCode:int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { DWORD nUserName = sizeof(acUserName); GetUserName(acUserName, &nUserName); kayit(); while(basla()==0) Sleep(2000); int some_dummy_var=1; HANDLE Handle_Of_Thread_1 = 0; Handle_Of_Thread_1 = CreateThread(NULL, 0, mythread, &some_dummy_var, 0, NULL); WaitForSingleObject(Handle_Of_Thread_1, INFINITE); return 0; }
Notice that "#under" should be "#undef" too. A typo by me.
How are you doing this, however?
1) First you should create a dll. File -> New -> Project -> Win32 -> Win32 Project-> Dll.
2) Write your code. In the header, put "EXPORT" before your function prototypes.
3) Create another project - an application this time. Right-click the solution, select Add -> Project -> Win32 -> Win32 Application -> Win32 Project.
4) Include your header file where the functions from your dll are.
5) Call the functions as usual.
6) Now before we link and run, right-click solution and select properties. Goto project dependencies. Select your app from the list and tick the box next to your dll.
7) Press F7 to compile and link your app and it should work.
thanks for nice explain..
Note: Do not use lcc-Win32 to create a dll, it will not work. Also dlls can be called through rundll32, this doesn't support passing parameters though (if at all), so create functions that don't have any parameters if you are going to call using this method instead of through an app.
long time no C; //seige
You miss 100% of the people you don't C;
Code:if (language != LANG_C && language != LANG_CPP) drown(language);