Let me start.
I need to write a dll with an export function to be called from another C/C++ program.
I write following:
Code: Select all
//library.ec
public struct MqlStr {int len; char *string;};
public dllexport int f2(MqlStr * pStr){ return 1; }
The crashed program report is following
Code: Select all
There has been a critical error
Time : 2010.03.15 20:40
Program : Client Terminal
Version : 4.00 (build: 225, 10 Jul 2009)
OS : Windows XP Professional 5.1 Service Pack 3 (Build 2600)
Processors : 2 x X86 (level 15)
Memory : 2086952/507712 kb
Exception : C0000005
Address : 00000000
Access Type : read
Access Addr : 00000000
Registers : EAX=00000000 CS=001b EIP=00000000 EFLGS=00010246
: EBX=00460044 SS=0023 ESP=022BBD48 EBP=022BBD80
: ECX=6788125A DS=0023 ESI=012EFF40 FS=003b
: EDX=000000FE ES=0023 EDI=012EFF48 GS=0000
Stack Trace : 00455691 FFFFFFFF 00000000 00000000
: 00000000 00000000 00000000 00000000
: 00000000 00000000 00000000 00000000
: 00000000 00000000 00000000 00000000
Modules :
1 : 00400000 002B1000 c:\program files\metatrader - alpari\terminal.exe
2 : 01870000 002C5000 c:\winxp\system32\xpsp2res.dll
3 : 08000000 00008000 c:\program files\yandex\punto switcher\pshook.dll
4 : 10000000 00004000 c:\program files\unlocker\unlockerhook.dll
5 : 5AD70000 00038000 c:\winxp\system32\uxtheme.dll
6 : 5ED00000 000CC000 c:\winxp\system32\opengl32.dll
7 : 61540000 0021B000 d:\opt\ecere\bin\ecere.dll
8 : 662B0000 00058000 c:\winxp\system32\hnetcfg.dll
9 : 67880000 00012000 c:\program files\metatrader - alpari\experts\libraries\library.dll
10 : 68B20000 00020000 c:\winxp\system32\glu32.dll
11 : 71A50000 0003F000 c:\winxp\system32\mswsock.dll
12 : 71A90000 00008000 c:\winxp\system32\wshtcpip.dll
13 : 71AA0000 00008000 c:\winxp\system32\ws2help.dll
14 : 71AB0000 00017000 c:\winxp\system32\ws2_32.dll
15 : 71B20000 00012000 c:\winxp\system32\mpr.dll
16 : 73000000 00026000 c:\winxp\system32\winspool.drv
17 : 73760000 0004B000 c:\winxp\system32\ddraw.dll
18 : 73BC0000 00006000 c:\winxp\system32\dciman32.dll
19 : 73DD0000 000FE000 c:\winxp\system32\mfc42.dll
20 : 74720000 0004C000 c:\winxp\system32\msctf.dll
21 : 76380000 00005000 c:\winxp\system32\msimg32.dll
22 : 76390000 0001D000 c:\winxp\system32\imm32.dll
23 : 763B0000 00049000 c:\winxp\system32\comdlg32.dll
24 : 76B40000 0002D000 c:\winxp\system32\winmm.dll
25 : 76C90000 00028000 c:\winxp\system32\imagehlp.dll
26 : 77120000 0008B000 c:\winxp\system32\oleaut32.dll
27 : 773D0000 00103000 c:\winxp\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.2600.5512_x-ww_35d4ce83\comctl32.dll
28 : 774E0000 0013D000 c:\winxp\system32\ole32.dll
29 : 77C10000 00058000 c:\winxp\system32\msvcrt.dll
30 : 77DD0000 0009B000 c:\winxp\system32\advapi32.dll
31 : 77E70000 00092000 c:\winxp\system32\rpcrt4.dll
32 : 77F10000 00049000 c:\winxp\system32\gdi32.dll
33 : 77F60000 00076000 c:\winxp\system32\shlwapi.dll
34 : 77FE0000 00011000 c:\winxp\system32\secur32.dll
35 : 7C800000 000F6000 c:\winxp\system32\kernel32.dll
36 : 7C900000 000B2000 c:\winxp\system32\ntdll.dll
37 : 7C9C0000 00817000 c:\winxp\system32\shell32.dll
38 : 7E410000 00091000 c:\winxp\system32\user32.dll
Call stack :
Code: Select all
public dllexport int f1(){return 1;}
The program documentation says that
May you could advice some debugging programs, information where I can learn how to debug the problem.Functions imported from DLL into the program must provide linkage convention accepted for Windows API functions. To provide such a convention, the key word __stdcall specific for compilers of Microsoft(r) company is used in the source codes of dlls written in C or C++ language.