User Tools

Site Tools


tutorial:dlllibrary

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tutorial:dlllibrary [2019/01/04 12:03]
admin [การระบุ Calling Convention]
tutorial:dlllibrary [2019/03/15 10:42] (current)
admin
Line 84: Line 84:
  
 <hidden Example-2: Static Calling .dll Library> <hidden Example-2: Static Calling .dll Library>
-**ตัวอย่าง** การเรียก Library ชื่อว่า Pipe เพื่อเก็บฟังก์ชั่นคำนวณหาพื้นที่หน้าตัดท่อ\\+**ตัวอย่าง** การเรียก Library ชื่อว่า Pipe (จาก Example-1) ​เพื่อเก็บฟังก์ชั่นคำนวณหาพื้นที่หน้าตัดท่อ\\
 __ข้อสังเกต__:​ ชื่อตัวแปร Argument ของในโปรแกรมนี้ ไม่ตรงกับใน .dll \\ __ข้อสังเกต__:​ ชื่อตัวแปร Argument ของในโปรแกรมนี้ ไม่ตรงกับใน .dll \\
   *ไฟล์นี้ ใช้ PipeArea1(const D,​Di:​double):​double \\   *ไฟล์นี้ ใช้ PipeArea1(const D,​Di:​double):​double \\
Line 118: Line 118:
  
 <hidden Example-3: Dynamic Calling .dll Library> <hidden Example-3: Dynamic Calling .dll Library>
-**ตัวอย่าง** การเรียก Library ชื่อว่า Pipe เพื่อเก็บฟังก์ชั่นคำนวณหาพื้นที่หน้าตัดท่อ\\+**ตัวอย่าง** การเรียก Library ชื่อว่า Pipe (จาก Example-1) ​เพื่อเก็บฟังก์ชั่นคำนวณหาพื้นที่หน้าตัดท่อ\\
 __ข้อสังเกต__:​ มีดังนี้ \\ __ข้อสังเกต__:​ มีดังนี้ \\
   *จะต้องมี unit ชื่อ Dynlibs\\   *จะต้องมี unit ชื่อ Dynlibs\\
Line 187: Line 187:
 **__ข้อควรระวัง__** - หากเราระบุ Calling Convention ใน .dll ไม่ตรงกับการเรียกใช้ในไฟล์ .exe ก็อาจทำให้เกิดการใส่ตัวแปรในแต่ละ Argument ของ Procedure/​Function สลับกันได้ จะนำไปสู่การคำนวณที่ผิดพลาดอย่างแน่นอน ​ **__ข้อควรระวัง__** - หากเราระบุ Calling Convention ใน .dll ไม่ตรงกับการเรียกใช้ในไฟล์ .exe ก็อาจทำให้เกิดการใส่ตัวแปรในแต่ละ Argument ของ Procedure/​Function สลับกันได้ จะนำไปสู่การคำนวณที่ผิดพลาดอย่างแน่นอน ​
 \\ \\ \\ \\
-**__หมายเหตุ__** - การไม่ระบุ Calling Convention นั้น จะหมายถึงการเรียกใช้งานแบบ default ซึ่งตัว ​default สำหรับ FPC คือ register+**__หมายเหตุ__** - การไม่ระบุ Calling Convention นั้น จะหมายถึงการเรียกใช้งานแบบ default ซึ่ง default ​calling convention ​สำหรับ FPC คือ register
 <hidden Example-4: Static Calling .dll Library using stdcall as calling convention>​ <hidden Example-4: Static Calling .dll Library using stdcall as calling convention>​
 **ตัวอย่าง** การเรียก Library ชื่อว่า Pipe เพื่อเก็บฟังก์ชั่นคำนวณหาพื้นที่หน้าตัดท่อ\\ **ตัวอย่าง** การเรียก Library ชื่อว่า Pipe เพื่อเก็บฟังก์ชั่นคำนวณหาพื้นที่หน้าตัดท่อ\\
tutorial/dlllibrary.1546578233.txt.gz · Last modified: 2019/01/04 12:03 by admin