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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ba7b74d2699f2def X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-02-15 20:14:54 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.cwix.com!prairie.attcanada.net!newsfeed.attcanada.net!204.127.161.4!wn4feed!worldnet.att.net!204.127.198.204!attbi_feed4!attbi.com!rwcrnsc53.POSTED!not-for-mail From: "Steve Doiel" Newsgroups: comp.lang.ada References: <3C6CC24D.D013A4AC@chariot.net.au> Subject: Re: object ada, visual c and tasking combined. X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: <11lb8.68374$Pz4.332450@rwcrnsc53> NNTP-Posting-Host: 12.225.227.101 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc53 1013832893 12.225.227.101 (Sat, 16 Feb 2002 04:14:53 GMT) NNTP-Posting-Date: Sat, 16 Feb 2002 04:14:53 GMT Organization: AT&T Broadband Date: Sat, 16 Feb 2002 04:14:53 GMT Xref: archiver1.google.com comp.lang.ada:20069 Date: 2002-02-16T04:14:53+00:00 List-Id: "john donoghue" wrote in message news:3C6CC24D.D013A4AC@chariot.net.au... > Hi all, > > I have a problem that perhaps someoneelse has encountered before and > found a way around. > Firstly, I have some legacy ada code that amongst other things displays > some stuff on a display via a custom graphics controller board. > Recently it has been decided to upgrade that by replacing the existing > graphics code with a visual c front end. Yuk. I always hate to see C replacing Ada in any context, oh well. > All well and good, I can build a gui in visual c in several cpp files > and link it in after defining a few pragmas to access the c > functionality - first problem with objectAda ... > it complains about conflicts between libcd.lib having variables that are > alreadt defined. > And also it complains about linking in some of the visual c dll's etc > and unresolved symbols and more. In the "pass to linker" options of ObjectAda try /nodefaultlib. I've seen something similar, but not quite the same that this corrected. > After getting sick of that, I decided to try compiling the gui part in > to a dll and link that to the ada code ... hey it works ... but to be > compatible with the old graphics stuff, the dll has to also call a few > ada functions that are within the main ada application ... no problem > ... let's send a structure from the ada code to the visual c code on > initialization that contains pointers to the functions that the c code > will need to call later. > ... It seems to work ... next problem .... The visual c windowing stuff > is in its own task, and there is also another C task that needs to wait > on an ada function to return with data - but everytime I call the > "pointered" functions from these tasks the app spits the dummy ( > terminates with a exception that provides no name or message or > anything. ) I had a similar problem. In my case I registered a callback with the DLL that needed to wait for something in on the Ada side. When I tried having the callback wait on a protected type, I don't remember the specific behavior, but bad things happened. The way I got around this is using the Win32 API objects, although I can't remember specifically which object, and I don't have the code handy. The Ada code creates the win32 (I'll call it a semaphore) and sets its state to empty. The callback trys to take the semaphore and pends until the semaphore is given. I hope this helps, SteveD > I am guessing that you cant call the ada functions from the other C > tasks since they are in other tasks to the ada functions :) ... but is > there a way around it? > > Cheers, > John >