crash on using imported function

 
Hello
I have written a dll in delphi which uses curl library to send some logs to my site , it works fine in delphi , I wrote an aplication in delphi which uses my dll and it is working fine. but when I try to use it in MetaTrader , it crashes ! here is the crashlog :

There has been a critical error
Time : 2007.05.07 01:59
Program : Client Terminal
Version : 4.00 (build: 204, 25 Apr 2007)
Owner : MIG Investments SA (MIG Trading Station)
OS : Windows XP Professional 5. 1 Service Pack 2 (Build 2600)
Processors : 2, type 586, level 15
Memory : 523500/106288 kb
Exception : C0000005
Address : 01017901
Access Type : read
Access Addr : 01017901

Registers : EAX=00000000 CS=001b EIP=01017901 EFLGS=00010246
: EBX=01A76DFC SS=0023 ESP=0256FF2C EBP=0256FF64
: ECX=01A72660 DS=0023 ESI=01A74823 FS=003b
: EDX=000000FE ES=0023 EDI=01A76E04 GS=0000

Stack Trace : 004528F3 7C80B683 00000000 00000000
: 00000000 00000000 00000000 00000000
: 00000000 00000000 00000000 00000000
: 00000000 00000000 00000000 00000000
Modules :
1 : 00400000 007BE000 C:\Program Files\Mig Demo\terminal. exe
2 : 02570000 00026000 C:\Program Files\Mig Demo\experts\libraries\curldllp. dll
3 : 10000000 0001D000 C:\WINDOWS\system32\avgfwafu. dll
4 : 20000000 002C5000 C:\WINDOWS\system32\xpsp2res. dll
5 : 5AD70000 00038000 C:\WINDOWS\system32\UxTheme. dll
6 : 5B0A0000 00007000 C:\WINDOWS\system32\umdmxfrm. dll
7 : 5CD70000 00007000 C:\WINDOWS\system32\serwvdrv. dll
8 : 60300000 00007000 C:\PROGRA~1\Yahoo!\MESSEN~1\idle. dll
9 : 629C0000 00009000 C:\WINDOWS\system32\LPK. DLL
10 : 662B0000 00058000 C:\WINDOWS\system32\hnetcfg. dll
11 : 6BD00000 0000D000 C:\WINDOWS\system32\SYNCOR11. DLL
12 : 70800000 00031000 C:\WINDOWS\system32\libcurl-4. dll
13 : 71A50000 0003F000 C:\WINDOWS\system32\mswsock. dll
14 : 71A90000 00008000 C:\WINDOWS\System32\wshtcpip. dll
15 : 71AA0000 00008000 C:\WINDOWS\system32\WS2HELP. dll
16 : 71AB0000 00017000 C:\WINDOWS\system32\WS2_32. dll
17 : 72D10000 00008000 C:\WINDOWS\system32\msacm32. drv
18 : 72D20000 00009000 C:\WINDOWS\system32\wdmaud. drv
19 : 73DD0000 000FE000 C:\WINDOWS\system32\MFC42. DLL
20 : 74720000 0004B000 C:\WINDOWS\system32\MSCTF. dll
21 : 74D90000 0006B000 C:\WINDOWS\system32\USP10. dll
22 : 755C0000 0002E000 C:\WINDOWS\system32\msctfime. ime
23 : 76380000 00005000 C:\WINDOWS\system32\MSIMG32. dll
24 : 76390000 0001D000 C:\WINDOWS\system32\IMM32. DLL
25 : 763B0000 00049000 C:\WINDOWS\system32\comdlg32. dll
26 : 769C0000 000B3000 C:\WINDOWS\system32\USERENV. dll
27 : 76B40000 0002D000 C:\WINDOWS\system32\WINMM. dll
28 : 76C30000 0002E000 C:\WINDOWS\system32\WINTRUST. dll
29 : 76C90000 00028000 C:\WINDOWS\system32\IMAGEHLP. dll
30 : 76F20000 00027000 C:\WINDOWS\system32\DNSAPI. dll
31 : 76F60000 0002C000 C:\WINDOWS\system32\WLDAP32. dll
32 : 76FB0000 00008000 C:\WINDOWS\System32\winrnr. dll
33 : 76FC0000 00006000 C:\WINDOWS\system32\rasadhlp. dll
34 : 77120000 0008C000 C:\WINDOWS\system32\OLEAUT32. dll
35 : 773D0000 00103000 C:\WINDOWS\WinSxS\x86_Microsoft. Windows. Common-Controls_6595b64144ccf1df_6. 0.2600.2982_x-ww_ac3f9c03\comctl32.dll
36 : 774E0000 0013D000 C:\WINDOWS\system32\ole32. dll
37 : 77A80000 00094000 C:\WINDOWS\system32\CRYPT32. dll
38 : 77B20000 00012000 C:\WINDOWS\system32\MSASN1. dll
39 : 77BD0000 00007000 C:\WINDOWS\system32\midimap. dll
40 : 77BE0000 00015000 C:\WINDOWS\system32\MSACM32. dll
41 : 77C10000 00058000 C:\WINDOWS\system32\msvcrt. dll
42 : 77DD0000 0009B000 C:\WINDOWS\system32\ADVAPI32. dll
43 : 77E70000 00091000 C:\WINDOWS\system32\RPCRT4. dll
44 : 77F10000 00047000 C:\WINDOWS\system32\GDI32. dll
45 : 77F60000 00076000 C:\WINDOWS\system32\SHLWAPI. dll
46 : 77FE0000 00011000 C:\WINDOWS\system32\Secur32. dll
47 : 7C340000 00056000 C:\PROGRA~1\Yahoo!\MESSEN~1\MSVCR71. dll
48 : 7C800000 000F4000 C:\WINDOWS\system32\kernel32. dll
49 : 7C900000 000B0000 C:\WINDOWS\system32\ntdll. dll
50 : 7C9C0000 00815000 C:\WINDOWS\system32\SHELL32. dll
51 : 7E410000 00090000 C:\WINDOWS\system32\USER32. DLL

Call stack :
004527E0:0113 [004528F3] ?RunExpertInt@CExpertInterior
7C80B4CF:01B4 [7C80B683] GetModuleFileNameA [C:\WINDOWS\system32\kernel32. dll]

can u please help me about it ?
Best Regards
 
I found the problem :-) it was because of not using stdcall keyword ;) dont forget to use it.
Regards
 

Hi:



I have a same problem, could you please be more specific on where you put your stdcall?



I use this code in creating delphi dll



function test(str: string): integer; export; stdcall;
begin

//some codes

//..

//..

Result:=1;

end;

exports test;



but still the terminal crashed when my script call the dll

 
Please change the str : string with str : pchar. String format on delphi different with C string format.
 

Hi, I´m really want know your source, because what i´m doing here is exacting same think you did do.
Delphi & CURL & SITE, If you stop your project I can keep working in that and send all update to you, respecting your copyright.

email or Gtalk: programadorvinicius@gmail.com
Skype: com.vini
yahoo: programadorvinicius@yahoo.com

Reason: