Hi to all,
I want to know how to get into dll file.
I do not now anythig about dll.
I do now something about Applications.
So if you can give some link with example and with dllEntryPoint i will send the GOD's to Answer your wishes(:D).I have nothing to offer.

A DLL is not very different than an EXE. (Both are PE32 files.) The primary difference is how they are expected to be used. (That is by no means the only significant difference, so you can't just rename your DLLs to EXEs and expect them to work...)

You might start out by checking out what MSDN has to say.

If by "get into a dll file" you mean that you want a list of its import and/or export tables, then google "pe32 import export table" to get started. There are system APIs to help here.

Hope this helps.

Yes it help but not enought for makeing suff.
I want i code example.
And can i calculate numbers in dll and back them to windows Application because i learn dll to do this.

So what you want to do is create your own DLL which your application can use to do something?

What programming environment are you using (compiler/IDE)?

doesn't matter what compiler you use. If you want to write a DLL then you need to create all those files as shown in the tutorial.

To start the DLL project select menu File --> New --> Project then select the DLL icon.

I allready try it and the
C:\Dev-Cpp\Makefile.win [Build Error] No rule to make target `"../Documents', needed by `Project1.dll'. Stop.

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.

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.

Thank you very much for your effort.
You are like my right hand.

Hi,
Can anyone explain why do i need header( .h) and
( .c) for creating DLL in C?
When i usally open Dev-C++->project dll, i got 2 files 1 cdll.h and 1 cmain.c ,and whan i compile i got a project.dll .Few words woud be grathfull .
Thank you for your reading.

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?

#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.

Hi , i use Dev-C++
That file working but not right because he must put my MessageBox on the screen Here is myfile.dll

#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.

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.

// prototype the function that is in the DLL
void __declspec (dlimport) function1();

int main()
{
     function1(); // call the function in the DLL

     return 0;
}

There is should ne bo reason why MessageBox should fail provided you make that call and system is not running out of handles.

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.

What ever ,if you have a any file wich will explain to me what to do in ( .lib) .Please post it.
And if you know how to create ( .lib) plz post it here.
Thank you for your time.

.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.

Hi,
when i ->include linking as
errors


Circular Untitled2 <- Untitled2.o dependency dropped.

Circular Untitled2 <- Untitled2.o dependency dropped.


When i turn off linking i get 3 more files ,
.dll, .lib, .a
And when i use my WIN API file who is some were above.Get no errors.BUT i did not see message box ,and it was ON included linking.

Hi,
when i ->include linking as
errors


Circular Untitled2 <- Untitled2.o dependency dropped.

Circular Untitled2 <- Untitled2.o dependency dropped.


When i turn off linking i get 3 more files ,
.dll, .lib, .a
And when i use my WIN API file who is some were above.Get no errors.BUT i did not see message box ,and it was ON included linking.

Well I could not understand the errors. I don't know how do you add lib refreence in dev++. however you can use #pragma comment(lib, "myfile.lib") in your cpp. It will autometicallty link the lib. After that you need not call the LoadLibrary. Just declare the prototype of function and call the function.

Hi,

#include <windows.h>
#pragma comment(lib, "myfile.lib")
typedef void  (*function1_ptr) ();
function1_ptr function1=NULL;//Now create pointer and set its default value to NULL


int APIENTRY WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { 
    
    HMODULE myDll = LoadLibrary("myfile.dll");
    
    if(myDll) {
        //obtain the function address
        function1 = (function1_ptr)GetProcAddress(myDll,"function1");  
    }  
    
    //use function where needed, but check before
    if(function1)
        function1();
        
    //finally free library
    FreeLibrary(myDll);
    
    
    return 0;
}

Had no errors and i have not seen message box

I am now really confused ,
Were to go to understand these dll,
When i seen MSDN i understud 2 types but when i seen code it is really confusing.

Hi,
I am really sorry it is my mistake.
It is working ,i get a message only when i put a
dll in same directory where is my exe and correct the names of .dll look up there code.

Thank you all for your effort for trying help me but basicly i needed to help my self.

But one or two more question 's what i do not understand.
1)When i writeing program in other language can i use dll or not?
2)It is his mistake or MSND

http://www.apitalk.com/document.php?id=1184209001_1
http://support.microsoft.com/kb/815065

Because he call this EXPLICITE and but msdn not.
3)MSND call load-time dyna... EXPLICIT
is it mind that run-time dyna... IMPLICIT?
4)When i use load-time is it mind when i load first time i do not need anymore dll?
5)Can i use any windows XP dll's?
6)What i need to do to attach another dll with this one?Do i need any other knowlage?
7)
if(function1)
function1();
Why the program won't work right without this ?
8)How to create different moduls in point of
runing faster programs.OR separate moduls.
9)I downloaded Visual C++ 2005 Expres Edition ,why i can't make a project ,what to do reslove that?

>>I downloaded Visual C++ 2005 Expres Edition ,why i can't make a project ,what to do reslove that?

To create a project: select menu File -->New -->Project, then set Project Type to Win32 and Visual Studio Installed Templates to Win32 Console Application. At the bottom of the screen enter the project name and select the desired location. Finally on that window press the Ok button.

The next window to appear is the Application Settings window. Select Console Application and press the Finish button.

All done.

It's working but only when i put
in additional option ,empty project.

1)When i writeing program in other language can i use dll or not?
Yes, you can use a DLL in any language. The trick is only to match the correct "calling convention". Google it and read more about it. Most Windows DLLs have "stdcall" calling convention.

2)It is his mistake or MSND ... Because he call this EXPLICITE and but msdn not.
Both are correct. The difference between explicit and implicit linking is just whether or not the compiler links for you. For example, when writing windows programs, if you include <windows.h> then you can use all kinds of functions found in Windows DLLs without having to explicitly say which DLLs you want to use.

3)MSND call load-time dyna... EXPLICIT is it mind that run-time dyna... IMPLICIT?
This is non-sequitur. If you use LoadLibrary() then that is run-time loading. Otherwise it is load-time loading. This is a fairly simple, but technical issue. You shouldn't need worry about it.

The main interest for the programmer is that if a load-time DLL is not found, your program will not run. However, a run-time DLL (loaded with LoadLibrary()) allows you to choose whether to continue execution or not.

4)When i use load-time is it mind when i load first time i do not need anymore dll?
I don't understand your question.

5)Can i use any windows XP dll's?
Sure, why not?

6)What i need to do to attach another dll with this one?Do i need any other knowlage?
DLLs are separate things. One DLL may use another DLL, just as your EXE may use a DLL, but they are still separate, self-contained things.

7)
if(function1)
function1();
Why the program won't work right without this ?

It is possible that the DLL you loaded doesn't have the requested function. You must check to make sure that the function exists before you use it.

Keep in mind that you are really using a C shortcut here. "function1" is a pointer to a function. So first you test to see if the pointer is not NULL, and if not, then you call the function. To be absolutely explicitly correct it should read: if (function1 != NULL) (*function1)(); C and C++ are nice and let you write it a shorter way: if (function1) function1(); 8)How to create different moduls in point of runing faster programs.OR separate moduls.
It makes no difference. (That is, if I understand your question correctly.)

Good luck!

This question has already been answered. Start a new discussion instead.