From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: undefined reference while calling an imported c function as procedure in ada
Date: Fri, 25 May 2018 18:41:47 +0300
Date: 2018-05-25T18:41:47+03:00 [thread overview]
Message-ID: <fmqp5rF4v5nU1@mid.individual.net> (raw)
In-Reply-To: <e7839a03-f2bf-4c6f-80cb-58b38792e247@googlegroups.com>
On 18-05-25 16:52 , boonflies@gmail.com wrote:
> We receive, undefined reference to `CLIENT_CR', while linking.
>
> The code we are building
> In Tftp.h
>
> `void CLIENT_CR
> (
> CREATE_INFO * CreateInfo,
> ID * SessionId,
> RESULT * Result
> );`
>
> 2. In Tftp.ads
> `procedure CLIENT_CR( CreateInfo : in Tpkg.CREATE_INFO;
> SessionId : out Tpkg.ID;
> Result : out RESULT );
>
> pragma Import (C, CLIENT_CR, "CLIENT_CR");`
>
> 3. In main.adb
> `#With TFTP;
>
> ...
> TFTP.CLIENT_CR(INFO,ID,RESULT)`
Apply the "nm" tool to the object (.o) file compiled from Tftp.c
(probably named Tftp.o) to see the link-name that the C (or C++?)
compiler assigns to the CLIENT_CR subprogram. Use that link-name in the
pragma Import.
Also, check that your linker command-line includes Tftp.o, or add a
pragma Linker_Options naming that file to the Ada declaration.
--
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
. @ .
prev parent reply other threads:[~2018-05-25 15:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-25 13:52 undefined reference while calling an imported c function as procedure in ada boonflies
2018-05-25 14:31 ` Jacob Sparre Andersen
2018-05-25 15:35 ` Dennis Lee Bieber
2018-05-25 15:41 ` Niklas Holsti [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox