Quote:
i dont know why you're definint int main() {}

I was getting error when I was trying to compile without main function. That's cos i was compiling it as EXE.

I found a way to make it as dll.
I clicked new project at Dev-C++ and C DLL
It gave me this:
Code:
/* Replace "dll.h" with the name of your header */
#include "dll.h"
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>

[color:red]DLLIMPORT void HelloWorld ()
{
    MessageBox (0, "Hello World from DLL!\n", "Hi", MB_ICONINFORMATION);
}[/color]


BOOL APIENTRY DllMain (HINSTANCE hInst     /* Library instance handle. */ ,
                       DWORD reason        /* Reason this function is being called. */ ,
                       LPVOID reserved     /* Not used. */ )
{
    switch (reason)
    {
      case DLL_PROCESS_ATTACH:
        break;

      case DLL_PROCESS_DETACH:
        break;

      case DLL_THREAD_ATTACH:
        break;

      case DLL_THREAD_DETACH:
        break;
    }

    /* Returns TRUE on success, FALSE on failure */
    return TRUE;
}


I removed the red lines, and I wrote that instead of them:
Code:
int __stdcall ret(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause)
{
       if (show) sprintf(data,"echo -a Do not hide of me :)");
       else sprintf(data,"echo -a %s",data);
       return 2;
}

This project created 2 files: dllmain.c and dll.h
The dllmain.c was the one I've shown you before.
This is the dll.h:
Code:
#ifndef _DLL_H_
#define _DLL_H_

#if BUILDING_DLL
# define DLLIMPORT __declspec (dllexport)
#else /* Not BUILDING_DLL */
# define DLLIMPORT __declspec (dllimport)
#endif /* Not BUILDING_DLL */


[color:red]DLLIMPORT void HelloWorld (void);[/color] 


#endif /* _DLL_H_ */


I replaced the red line from here with:
Code:
int __stdcall ret(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause);

I also changed the order of headers from dllmain.c, so dll.h was included last (cos windows.h is needed by dll.h for setting the prototype, cos prototype contains types of variables defined in windows.h)

Compiled with no errors, everything was fine.
I set the project name dll1, so dll1.dll was created, also libdll1.def was created.
The contents of libdll1.def are:
Code:
; dlltool --base-file C:\DOCUME~1\x\LOCALS~1\Temp/cca03464.base --output-exp dll1.exp --dllname dll1.dll --output-def libdll1.def --no-export-all-symbols --add-stdcall-alias --exclude-symbol=DllMainCRTStartup@12 --def C:\DOCUME~1\x\LOCALS~1\Temp/cca03464.def --output-lib libdll1.a
EXPORTS


For some reason the function ret() wasn't added to exports (means he didn't recognize it, means I did something wrong)... Also, I tried using //echo -a : $dll(dll1.dll,ret,just a lil test), but I get the same error:
Quote:

* $dll: no such routine 'ret'

I also tried adding the ret function in the definition file like that:
Code:
ret = _ret@24

But still not working. This starts annoying me. Any ideeas what can I do ?