comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@acm.org>
To: comp.lang.ada@ada-france.org
Subject: Re: function from dll
Date: 22 Jan 2004 18:43:07 -0500
Date: 2004-01-22T18:43:07-05:00	[thread overview]
Message-ID: <mailman.3.1074815001.2270.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: <bupck6$rqm$1@nemesis.news.tpi.pl>

Szymon Guz <alpha@skynetSMIECI.VONorg.NOJUSZpl> writes:

> Hi,
> I've got maybe a trivial question but I still can't solve the problem:
> 
> I've a dll written in C under Windows and I want to use specific
> function from that in my Ada program. For loading the library I use
> the WinApi function LoadLibrary and then I use the function
> GetProcAddress to get the Win32.Windef.FARPROC handle to the function
> that I need. I need to map the function from the dll in Ada to have
> sth like that:
> 
> <C++ CODE>
> void sth(){}
> </C++ CODE>
> 
> <ADA CODE>
> function sth() return Integer;
> </ADA CODE>

The Ada spec doesn't match the C spec; the C code does not return an
int.

> now I want to run in the ada function body the function from dll...
> well how to use the Win32.Windef.FARPROC handle ?

I've never actually done this, but you can probably define an access
to procedure type, and do an unchecked conversion from System.Address
to it.

-- 
-- Stephe




  reply	other threads:[~2004-01-22 23:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-22 20:36 function from dll Szymon Guz
2004-01-22 23:43 ` Stephen Leake [this message]
2004-01-23  1:59   ` tmoran
2004-01-23  6:05 ` Per Sandberg
replies disabled

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