From: Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP>
Subject: Re: Interface with C codes
Date: Sun, 19 Oct 2014 09:24:16 +0000 (UTC)
Date: 2014-10-19T09:24:16+00:00 [thread overview]
Message-ID: <m20000$hbm$1@dont-email.me> (raw)
In-Reply-To: f56c3da6-e1fa-48c3-accc-6e912dc413e7@googlegroups.com
On 2014-10-19, Anh Vo <anhvofrcaus@gmail.com> wrote:
> On Saturday, October 18, 2014 11:33:32 AM UTC-7, Stephen Leake wrote:
>> Anh Vo <anhvofrcaus@gmail.com> writes:
>> > On Friday, October 17, 2014 4:22:15 PM UTC-7, Anh Vo wrote:
>> >>
>> >> char * bootStringToStruct (char * bootString, BOOT_PARAMS * pBootParams);
>> >
>> > Should this one work?
>> >
>> > function Boot_String_To_Type (
>> > Boot_String : Interfaces.C.Strings.chars_ptr;
>> > Boot_Params : Boot_Parameter_Type_Access)
>> > return Interfaces.C.Strings.chars_ptr;
>> > pragma Import (C, Boot_String_To_Type, "bootStringToStruct");
>>
>> Looks good. but give -fdump-ada-spec a try.
>
> Yes, I tried and the result is below.
>
> function bootStringToStruct (bootString : Interfaces.C.Strings.chars_ptr;
> pBootParams : access BOOT_PARAMS)
> return Interfaces.C.Strings.chars_ptr;
> pragma Import (CPP, bootStringToStruct, "_Z18bootStringToStructPcP11BOOT_PARAMS");
>
> Why was "_Z18bootStringToStructPcP11BOOT_PARAMS" generated for third parameter of pragma Import? I thought it should be "bootStringToStruct".
>
It's known as a mangled symbol and is required with C++ (notice your
latter example is using "CPP" and not "C" on the pragma Import).
The "Name mangling in C++" section of the following might be useful:
http://en.wikipedia.org/wiki/Name_mangling
Simon.
--
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world
next prev parent reply other threads:[~2014-10-19 9:24 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-17 23:22 Interface with C codes Anh Vo
2014-10-17 23:30 ` Anh Vo
2014-10-18 18:33 ` Stephen Leake
2014-10-19 4:33 ` Anh Vo
2014-10-19 9:24 ` Simon Clubley [this message]
2014-10-19 11:46 ` Brian Drummond
2014-10-19 13:58 ` Simon Wright
2014-10-19 17:33 ` Anh Vo
2014-10-17 23:49 ` Adam Beneschan
2014-10-18 0:04 ` Anh Vo
2014-10-18 1:04 ` Anh Vo
2014-10-20 16:14 ` Adam Beneschan
2014-10-25 3:31 ` Anh Vo
2014-10-18 2:20 ` Jeffrey Carter
2014-10-18 17:00 ` Anh Vo
2014-10-18 6:27 ` Per Sandberg
2014-10-18 17:08 ` Anh Vo
2014-10-18 17:12 ` Simon Wright
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox