mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2014
Posts: 8
A
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
A
Joined: Mar 2014
Posts: 8
Nothing I do seems to allow mIRC to find the functions regardless of what I name them. The version of MinGW is g++ (tdm-2) 4.8.1-dw2 and mIRC is 7.32. The old method of mine used to work but that was a compiler and client version ago.

Joined: Dec 2002
Posts: 252
T
Fjord artisan
Offline
Fjord artisan
T
Joined: Dec 2002
Posts: 252
try adding -Wl,--add-stdcall-alias to your linker options. Without this, your extern calls will wind up being somefunc@something... adding these flags makes the "alias" somefunc to the actual function, and then when you load the DLL with mIRC, you should be able to reference them by the name you'd expect.

I too use MinGW. Here is the output of the DEF file when I compiled my dll with these flags.

Code:
EXPORTS
    ClosestBallCollision = ClosestBallCollision@24 @1
    ClosestBallCollision@24 @2
    ClosestWallCollision = ClosestWallCollision@24 @3
    ClosestWallCollision@24 @4
    GetBall = GetBall@24 @5
    GetBall@24 @6
    InMotion = InMotion@24 @7
    InMotion@24 @8
    IsBallInHand = IsBallInHand@24 @9
    IsBallInHand@24 @10
    IsBreak = IsBreak@24 @11
    IsBreak@24 @12
    LoadDll = LoadDll@4 @13
    LoadDll@4 @14
    NumBalls = NumBalls@24 @15
    NumBalls@24 @16
    PlaceCue = PlaceCue@24 @17
    PlaceCue@24 @18
    Setup = Setup@24 @19
    Setup@24 @20
    SetupEightBall = SetupEightBall@24 @21
    SetupEightBall@24 @22
    StrikeCue = StrikeCue@24 @23
    StrikeCue@24 @24
    UnloadDll = UnloadDll@4 @25
    UnloadDll@4 @26
    UpdateTableFrame = UpdateTableFrame@24 @27
    UpdateTableFrame@24 @28


Heres my extern definitions in my main.cpp
Code:
extern "C" __declspec(dllexport) int __stdcall InMotion(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause);
extern "C" __declspec(dllexport) int __stdcall IsBreak(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause);
extern "C" __declspec(dllexport) int __stdcall IsBallInHand(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause);
extern "C" __declspec(dllexport) int __stdcall SetupEightBall(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause);
extern "C" __declspec(dllexport) int __stdcall Setup(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause);
extern "C" __declspec(dllexport) int __stdcall UpdateTableFrame(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause);
extern "C" __declspec(dllexport) int __stdcall NumBalls(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause);
extern "C" __declspec(dllexport) int __stdcall GetBall(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause);
extern "C" __declspec(dllexport) int __stdcall PlaceCue(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause);
extern "C" __declspec(dllexport) int __stdcall StrikeCue(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause);
extern "C" __declspec(dllexport) int __stdcall ClosestBallCollision(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause);
extern "C" __declspec(dllexport) int __stdcall ClosestWallCollision(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause);


As you can see, when compiled, the actual call winds up being myfunc@24 ... But with the added linker options theres now an alias with the proper function name to the generated function.


Link Copied to Clipboard