From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,39ade949adb6bf4 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder.news-service.com!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: StdCall and pragma Import_Function Date: Fri, 19 Aug 2011 21:43:18 +0200 Organization: cbb software GmbH Message-ID: <1je5iuczb7anp.1vt48byg9dio7$.dlg@40tude.net> References: <332032a4-0acf-459d-a743-e90e823ca5af@glegroupsg2000goo.googlegroups.com> <118ybwhr53151$.fjqabmpo2k23$.dlg@40tude.net> <3feb634f-ca38-4f08-a6da-5299233f295e@glegroupsg2000goo.googlegroups.com> <11f8n1nxhs0hg$.16p4wm0m6u4nt.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: 4BmpYiTkDr8UHtmbtlcLdg.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: g2news1.google.com comp.lang.ada:20689 Date: 2011-08-19T21:43:18+02:00 List-Id: On Fri, 19 Aug 2011 12:23:49 -0700 (PDT), Felix Krause wrote: > From the header file: > > extern CL_API_ENTRY cl_int CL_API_CALL > clGetDeviceIDs(cl_platform_id /* platform */, > cl_device_type /* device_type */, > cl_uint /* num_entries */, > cl_device_id * /* devices */, > cl_uint * /* num_devices */) CL_API_SUFFIX__VERSION_1_0; > > Those macros are defined as: > > #if defined(_WIN32) || defined(__CYGWIN__) > #define CL_API_ENTRY > #define CL_API_CALL __stdcall > #define CL_CALLBACK __stdcall > #else > #define CL_API_ENTRY > #define CL_API_CALL > #define CL_CALLBACK > #endif > > So it indeed uses StdCall convention. The corresponding output of dumpbin is: > > Version : 0 > Machine : 14C (x86) > TimeDateStamp: 4E03B987 Fri Jun 24 00:09:11 2011 > SizeOfData : 0000001E > DLL name : OpenCL.dll > Symbol name : _clGetDeviceIDs@24 > Type : code > Name type : undecorate > Hint : 44 > Name : clGetDeviceIDs > > (I don't have a def file, but this shows the fully qualified name too.) > > cl_device_type is the bitvector from my example, and GNAT searches for "clGetDeviceIDs@20". How are the types of the arguments declared? cl_int cl_platform_id cl_device_type cl_device_id cl_uint BTW, you will have problems with making bindings to this mess portable. I had similar issues with poorly designed Glib. They too have the linkage names varying from platform to platform. I solved that by using GNU linker weak references and wrappers. Not nice, but they refused to fix the problem. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de