comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <onewingedshark@gmail.com>
Subject: Re: Using dll from a C# code
Date: Wed, 29 Feb 2012 12:00:39 -0800 (PST)
Date: 2012-02-29T12:00:39-08:00	[thread overview]
Message-ID: <e84193f9-8470-41b8-aae3-adce7705cf98@c21g2000yqi.googlegroups.com> (raw)
In-Reply-To: 3622013.252.1330516368698.JavaMail.geo-discussion-forums@ynkz21

On Feb 29, 5:52 am, "Rego, P." <pvr...@gmail.com> wrote:
> Hello,
>
> I have a method in C# which I need to export to Ada using a dll. Maybe
>
> // simple.cs
> // compile with csc /t:library simple.cs
> using System;
> public class VerifyClass{
>         public bool Verify(){
>                 return true;
>         }
>
> }
>
> In order to use the function Verify() in Ada, I need to import this to something like
> -- simple.ads
> package Simple is
>         function Verify return Boolean;
>         pragma Import
>         (Convention    => dll,
>         Entity        => Verify,
>         External_Name => "Verify");
> end Simple;
>
> And I could use with
> -- main.adb
> -- build with gnatmake main -largs -lsimple
> with Text_IO; use Text_IO;
> with Simple; use Simple;
> procedure Main is
> begin
>         Put_Line (Boolean'Image (Verify));
> end Main;
>
> When I build the Ada with
> gnatmake main -largs -lsimple
>
> the compiler returns me
> ./main.o(.text+0xd6):main.adb: undefined reference to `Verify@0'
>
> So what have I missed? Maybe the C# code structure should be changed?

You have to be sure you are using the compiler for .NET; I think
there's something about qualifying names too, but I don't remember
what. You may want to check out the import pragma on page 16 in this
pdf: http://www.usafa.edu/df/dfe/dfer/centers/accr/docs/carlisle2006b.pdf




  reply	other threads:[~2012-02-29 20:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-29 11:52 Using dll from a C# code Rego, P.
2012-02-29 20:00 ` Shark8 [this message]
2012-03-01  2:26   ` Rego, P.
2012-03-01  5:38     ` Gautier write-only
2012-03-01 11:41       ` Rego, P.
2012-03-01 13:16         ` Georg Bauhaus
2012-03-01 14:38         ` gautier_niouzes
2012-03-01 15:15           ` Rego, P.
2012-03-01 16:24             ` Gautier write-only
2012-03-02 20:03               ` Rego, P.
2012-03-01 16:25             ` Georg Bauhaus
2012-03-02 21:15               ` Rego, P.
2012-03-02  3:37 ` mjamesb
2012-03-02 21:17   ` Rego, P.
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox