"Language-Team: Persian (https://github.com/python/python-docs-fa/)\n"
"Language: fa\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
msgid"Building C and C++ Extensions on Windows"
msgstr"ساخت ماژولهای توسعهای C و ++C در ویندوز"
msgid"This chapter briefly explains how to create a Windows extension module for Python using Microsoft Visual C++, and follows with more detailed background information on how it works. The explanatory material is useful for both the Windows programmer learning to build Python extensions and the Unix programmer interested in producing software which can be successfully built on both Unix and Windows."
msgstr"این فصل بهطور خلاصه توضیح میدهد که چگونه میتوان با استفاده از Microsoft Visual C++ یک ماژول توسعهای ویندوزی برای پایتون ایجاد کرد، و سپس با اطلاعات پسزمینهی دقیقتری دربارهی نحوهی کارکرد آن ادامه مییابد. این مطالب توضیحی هم برای برنامهنویس ویندوزی که در حال یادگیری ساخت توسعههای پایتون است و هم برای برنامهنویس یونیکسی که علاقهمند به تولید نرمافزاری است که میتوان آن را با موفقیت هم روی یونیکس و هم روی ویندوز ساخت، مفید است."
msgid"Module authors are encouraged to use the distutils approach for building extension modules, instead of the one described in this section. You will still need the C compiler that was used to build Python; typically Microsoft Visual C++."
msgstr"به نویسندگان ماژولها توصیه میشود که برای ساخت ماژولهای توسعهای، بهجای روش توصیفشده در این بخش، از رویکرد distutils استفاده کنند. شما همچنان به همان کامپایلر C که برای ساخت پایتون استفاده شده است نیاز خواهید داشت؛ که معمولاً Microsoft Visual C++ است."
msgid"This chapter mentions a number of filenames that include an encoded Python version number. These filenames are represented with the version number shown as ``XY``; in practice, ``'X'`` will be the major version number and ``'Y'`` will be the minor version number of the Python release you're working with. For example, if you are using Python 2.2.1, ``XY`` will actually be ``22``."
msgstr"این فصل به تعدادی از نامهای پرونده اشاره میکند که شامل شمارهی نسخهی کدگذاریشدهی پایتون هستند. این نامهای پرونده با شمارهی نسخهای که بهصورت ``XY`` نمایش داده شده بازنمایی میشوند؛ در عمل، ``'X'`` شمارهی نسخهی اصلی و ``'Y'`` شمارهی نسخهی فرعی انتشار پایتونی است که با آن کار میکنید. برای مثال، اگر از پایتون 2.2.1 استفاده میکنید، ``XY`` در واقع ``22`` خواهد بود."
msgid"A Cookbook Approach"
msgstr"رویکرد کتاب آشپزی"
msgid"There are two approaches to building extension modules on Windows, just as there are on Unix: use the ``setuptools`` package to control the build process, or do things manually. The setuptools approach works well for most extensions; documentation on using ``setuptools`` to build and package extension modules is available in :ref:`setuptools-index`. If you find you really need to do things manually, it may be instructive to study the project file for the :source:`winsound <PCbuild/winsound.vcxproj>` standard library module."
msgstr"همانطور که در یونیکس، در ویندوز نیز دو رویکرد برای ساخت ماژولهای توسعهای وجود دارد: استفاده از بستهی ``setuptools`` برای کنترل فرایند ساخت، یا انجام کارها بهصورت دستی. رویکرد setuptools برای بیشتر ماژولهای توسعهای بهخوبی کار میکند؛ مستندات مربوط به استفاده از ``setuptools`` برای ساخت و بستهبندی ماژولهای توسعهای در :ref:`setuptools-index` در دسترس است. اگر دریافتید که واقعاً باید کارها را بهصورت دستی انجام دهید، مطالعهی پروندهی پروژهی ماژول :source:`winsound <PCbuild/winsound.vcxproj>` از کتابخانه استاندارد میتواند آموزنده باشد."
msgid"Differences Between Unix and Windows"
msgstr"تفاوتهای بین Unix و Windows"
msgid"Unix and Windows use completely different paradigms for run-time loading of code. Before you try to build a module that can be dynamically loaded, be aware of how your system works."
msgstr"یونیکس و ویندوز از پارادایمهای کاملاً متفاوتی برای بارگذاری کد در زمان اجرا استفاده میکنند. پیش از آنکه تلاش کنید ماژولی بسازید که بتوان آن را بهصورت پویا بارگذاری کرد، از چگونگی کارکرد سیستم خود آگاه باشید."
msgid"In Unix, a shared object (:file:`.so`) file contains code to be used by the program, and also the names of functions and data that it expects to find in the program. When the file is joined to the program, all references to those functions and data in the file's code are changed to point to the actual locations in the program where the functions and data are placed in memory. This is basically a link operation."
msgstr"در یونیکس، یک پروندهی شیء اشتراکی (shared object) (:file:`.so`) شامل کدی است که قرار است توسط برنامه استفاده شود، و همچنین نام توابع و دادههایی که انتظار دارد آنها را در برنامه بیابد. هنگامی که پرونده به برنامه الحاق میشود، تمام ارجاعها به آن توابع و دادهها در کدِ پرونده تغییر میکنند تا به مکانهای واقعی در برنامه — جایی که توابع و دادهها در حافظه قرار گرفتهاند — اشاره کنند. این اساساً یک عملیات پیوند است."
msgid"In Windows, a dynamic-link library (:file:`.dll`) file has no dangling references. Instead, an access to functions or data goes through a lookup table. So the DLL code does not have to be fixed up at runtime to refer to the program's memory; instead, the code already uses the DLL's lookup table, and the lookup table is modified at runtime to point to the functions and data."
msgstr"در ویندوز، پرونده کتابخانه پیوند پویا (:file:`.dll`) هیچ ارجاع معلقی ندارد. در عوض، دسترسی به توابع یا دادهها از طریق یک جدول جستجو انجام میشود. بنابراین، کد DLL لازم نیست در رانتایم برای ارجاع به حافظه برنامه اصلاح شود؛ در عوض، کد از پیش از جدول جستجوی DLL استفاده میکند و جدول جستجو در رانتایم تغییر داده میشود تا به توابع و دادهها اشاره کند."
msgid"In Unix, there is only one type of library file (:file:`.a`) which contains code from several object files (:file:`.o`). During the link step to create a shared object file (:file:`.so`), the linker may find that it doesn't know where an identifier is defined. The linker will look for it in the object files in the libraries; if it finds it, it will include all the code from that object file."
msgstr"در یونیکس، تنها یک نوع پرونده کتابخانه (:file:`.a`) وجود دارد که حاوی کد چندین پرونده شیء (:file:`.o`) است. در طول مرحله پیوند برای ایجاد یک پرونده شیء اشتراکی (:file:`.so`)، ممکن است پیونددهنده دریابد که نمیداند یک شناسه در کجا تعریف شده است. پیونددهنده آن را در پروندههای شیء موجود در کتابخانهها جستوجو میکند؛ اگر آن را پیدا کند، تمام کد آن پرونده شیء را در بر میگیرد."
msgid"In Windows, there are two types of library, a static library and an import library (both called :file:`.lib`). A static library is like a Unix :file:`.a` file; it contains code to be included as necessary. An import library is basically used only to reassure the linker that a certain identifier is legal, and will be present in the program when the DLL is loaded. So the linker uses the information from the import library to build the lookup table for using identifiers that are not included in the DLL. When an application or a DLL is linked, an import library may be generated, which will need to be used for all future DLLs that depend on the symbols in the application or DLL."
msgstr "در ویندوز، دو نوع کتابخانه وجود دارد: کتابخانهی ایستا و کتابخانهی ایمپورت (هر دو :file:`.lib` نامیده میشوند). کتابخانهی ایستا مانند پروندهی :file:`.a` در یونیکس است؛ حاوی کدی است که در صورت نیاز گنجانده میشود. کتابخانهی ایمپورت اساساً فقط برای اطمیناندادن به پیونددهنده که شناسهی مشخصی معتبر است و هنگام بارگذاری DLL در برنامه موجود خواهد بود، استفاده میشود. بنابراین پیونددهنده از اطلاعات کتابخانهی ایمپورت برای ساخت جدول جستجوی شناسههایی که در DLL گنجانده نشدهاند، استفاده میکند. هنگامی که یک برنامه یا DLL پیوند داده میشود، ممکن است یک کتابخانهی ایمپورت تولید شود که باید برای تمام DLLهای آیندهای که به نمادهای موجود در آن برنامه یا DLL وابستهاند، استفاده شود."
msgid"Suppose you are building two dynamic-load modules, B and C, which should share another block of code A. On Unix, you would *not* pass :file:`A.a` to the linker for :file:`B.so` and :file:`C.so`; that would cause it to be included twice, so that B and C would each have their own copy. In Windows, building :file:`A.dll` will also build :file:`A.lib`. You *do* pass :file:`A.lib` to the linker for B and C. :file:`A.lib` does not contain code; it just contains information which will be used at runtime to access A's code."
msgstr"فرض کنید در حال ساخت دو ماژول بارگذاری پویا به نام B و C هستید که باید بلوک کد دیگری به نام A را به اشتراک بگذارند. در یونیکس، شما :file:`A.a` را برای :file:`B.so` و :file:`C.so` به پیونددهنده *نمیدهید*؛ این کار باعث میشود که A دو بار گنجانده شود، بهطوری که B و C هر یک نسخهی خود را داشته باشند. در ویندوز، با ساخت :file:`A.dll`، :file:`A.lib` نیز ساخته میشود. شما :file:`A.lib` را برای B و C به پیونددهنده *میدهید*. :file:`A.lib` حاوی کد نیست؛ فقط حاوی اطلاعاتی است که در زمان اجرا برای دسترسی به کد A استفاده خواهند شد."
msgid"In Windows, using an import library is sort of like using ``import spam``; it gives you access to spam's names, but does not create a separate copy. On Unix, linking with a library is more like ``from spam import *``; it does create a separate copy."
msgstr"در ویندوز، استفاده از کتابخانه ایمپورت (import library) تا حدی شبیه استفاده از ``import spam`` است؛ به شما دسترسی به نامهای spam میدهد، اما نسخه جداگانهای ایجاد نمیکند. در یونیکس، پیوند دادن با یک کتابخانه بیشتر شبیه ``from spam import *`` است؛ و نسخه جداگانهای ایجاد میکند."
msgid"Turn off the implicit, ``#pragma``-based linkage with the Python library, performed inside CPython header files."
msgstr"پیوند ضمنی و مبتنی بر ``#pragma`` با کتابخانهی پایتون را که درون پروندههای سرآیند سیپایتون انجام میشود، غیرفعال کنید."
msgid"Using DLLs in Practice"
msgstr"استفاده از DLLها در عمل"
msgid"Windows Python is built in Microsoft Visual C++; using other compilers may or may not work. The rest of this section is MSVC++ specific."
msgstr"نسخهی ویندوزی پایتون با Microsoft Visual C++ ساخته میشود؛ استفاده از کامپایلرهای دیگر ممکن است کار کند یا نکند. بقیهی این بخش ویژهی MSVC++ است."
msgid"When creating DLLs in Windows, you can use the CPython library in two ways:"
msgstr"هنگام ساخت DLLها در ویندوز، میتوانید از کتابخانه سیپایتون به دو روش استفاده کنید:"
msgid"By default, inclusion of :file:`PC/pyconfig.h` directly or via :file:`Python.h` triggers an implicit, configure-aware link with the library. The header file chooses :file:`pythonXY_d.lib` for Debug, :file:`pythonXY.lib` for Release, and :file:`pythonX.lib` for Release with the :ref:`Limited API <stable-application-binary-interface>` enabled."
msgstr"بهطور پیشفرض، گنجاندن :file:`PC/pyconfig.h` بهصورت مستقیم یا از طریق :file:`Python.h` موجب برقراری یک پیوند ضمنی و آگاه از پیکربندی با کتابخانه میشود. پروندهی سرآیند برای Debug، :file:`pythonXY_d.lib`؛ برای Release، :file:`pythonXY.lib`؛ و برای Release با فعال بودن :ref:`API محدود <stable-application-binary-interface>`، :file:`pythonX.lib` را انتخاب میکند."
msgid"To build two DLLs, spam and ni (which uses C functions found in spam), you could use these commands::"
msgstr"برای ساخت دو DLL با نامهای spam و ni (که از توابع C موجود در spam استفاده میکند)، میتوانید از این دستورها استفاده کنید::"
msgid""
"cl /LD /I/python/include spam.c\n"
"cl /LD /I/python/include ni.c spam.lib"
msgstr""
"cl /LD /I/python/include spam.c\n"
"cl /LD /I/python/include ni.c spam.lib"
msgid"The first command created three files: :file:`spam.obj`, :file:`spam.dll` and :file:`spam.lib`. :file:`Spam.dll` does not contain any Python functions (such as :c:func:`PyArg_ParseTuple`), but it does know how to find the Python code thanks to the implicitly linked :file:`pythonXY.lib`."
msgstr"فرمان نخست سه پرونده ایجاد کرد: :file:`spam.obj`، :file:`spam.dll` و :file:`spam.lib`. :file:`Spam.dll` هیچ تابع پایتونی (مانند :c:func:`PyArg_ParseTuple`) ندارد، اما به لطف پیوند ضمنی :file:`pythonXY.lib` میداند که کد پایتون را چگونه پیدا کند."
msgid"The second command created :file:`ni.dll` (and :file:`.obj` and :file:`.lib`), which knows how to find the necessary functions from spam, and also from the Python executable."
msgstr"دستور دوم :file:`ni.dll` را ایجاد کرد (به همراه :file:`.obj` و :file:`.lib`)، که میداند چگونه توابع لازم را از spam و همچنین از پرونده اجرایی پایتون پیدا کند."
msgid"Manually by defining :c:macro:`Py_NO_LINK_LIB` macro before including :file:`Python.h`. You must pass :file:`pythonXY.lib` to the linker."
msgstr"بهصورت دستی، با تعریف ماکروی :c:macro:`Py_NO_LINK_LIB` پیش از شامل کردن :file:`Python.h`. باید :file:`pythonXY.lib` را به پیونددهنده بدهید."
msgid"The first command created three files: :file:`spam.obj`, :file:`spam.dll` and :file:`spam.lib`. :file:`Spam.dll` does not contain any Python functions (such as :c:func:`PyArg_ParseTuple`), but it does know how to find the Python code thanks to :file:`pythonXY.lib`."
msgstr"دستور اول سه پرونده ایجاد کرد: :file:`spam.obj`، :file:`spam.dll` و :file:`spam.lib`. :file:`Spam.dll` هیچ تابع پایتونی (مانند :c:func:`PyArg_ParseTuple`) در بر نمیگیرد، اما به لطف :file:`pythonXY.lib` میداند چگونه کد پایتون را پیدا کند."
msgid"Not every identifier is exported to the lookup table. If you want any other modules (including Python) to be able to see your identifiers, you have to say ``_declspec(dllexport)``, as in ``void _declspec(dllexport) initspam(void)`` or ``PyObject _declspec(dllexport) *NiGetSpamData(void)``."
msgstr"هر شناسهای به جدول جستجو اکسپورت نمیشود. اگر میخواهید ماژولهای دیگر (از جمله پایتون) بتوانند شناسههای شما را ببینند، باید ``_declspec(dllexport)`` را بنویسید، مانند ``void _declspec(dllexport) initspam(void)`` یا ``PyObject _declspec(dllexport) *NiGetSpamData(void)``."
msgid"Developer Studio will throw in a lot of import libraries that you do not really need, adding about 100K to your executable. To get rid of them, use the Project Settings dialog, Link tab, to specify *ignore default libraries*. Add the correct :file:`msvcrt{xx}.lib` to the list of libraries."
msgstr"Developer Studio تعداد زیادی کتابخانهی ایمپورت که واقعاً به آنها نیاز ندارید را اضافه میکند و حدود ۱۰۰ کیلوبایت به پروندهی اجرایی شما میافزاید. برای خلاص شدن از آنها، از کادر گفتوگوی Project Settings، زبانهی Link، برای مشخص کردن *ignore default libraries* استفاده کنید. کتابخانهی مناسب :file:`msvcrt{xx}.lib` را به فهرست کتابخانهها اضافه کنید."