Ask a question about calling the DLL compiled under VC ??? Weird.

Source: Internet
Author: User
Ask a question about calling the DLL compiled under VC ??? Strange. Delphi/Windows SDK/API
Http://www.delphi2007.net/DelphiBase/html/delphi_20061220075845111.html
Interface Function Definition:
Extern "C" dllexport int pcfilecopytoother (char disk,
Lpcstr pcfilename,
Lpcstr otherfilename,
Bool isdispprogress,
Lpcstr message)
I introduced the following in Delphi:
Function pcfilecopytoother (Disk: byte; pcfilename: pchar; otherfilename: pchar;
Isdispprogress: Boolean; mess: pchar): integer; stdcall;
Function pcfilecopytodev; External f3200_dll name 'pcfilecopytoother ';
I called it like this:
Pcfilecopytoother(0, pchar('1.txt'character, pchar('2.txt '), true, pchar (' Please wait ...'));
When running, there are few errors in the XP system, but when running on the 2003 Server System, there is a "memory read error "; when I change pchar to objective string, although there is no error, the parameter value may be incorrect and the expected value will not be obtained for each call.
It should be pchar for the lpcstr.

Stdcall-> cdecl in Delphi

Upstairs, I still can't do it. Is XP different from 2003 server?

There is no error when using struct string, but how can we pass the parameter?

Debug ~~

What does upstairs mean?

Is relative to release

Nobody knows?

It seems that the distribution cannot go down.

the possible cause is that if you use a constant to change the parameter value in the function, an error will occur.
the solution is to use array [0 .. xxx] of char replace pchar
or use pchar, but first apply for memory, then assign values, and then call the function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.