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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,CP1252 X-Google-Thread: 103376,8141f2ef049fcd7e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-11 04:44:55 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!213.56.195.71!fr.usenet-edu.net!usenet-edu.net!enst!enst.fr!not-for-mail From: "David Botton" Newsgroups: comp.lang.ada Subject: Re: Help with GNAT, WinNT, StdCall, dll, exported names Date: Thu, 11 Oct 2001 07:44:12 -0400 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: References: <%lfx7.6$_o6.503@newsc.telia.net> Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 8bit X-Trace: avanie.enst.fr 1002800694 83232 137.194.161.2 (11 Oct 2001 11:44:54 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Thu, 11 Oct 2001 11:44:54 +0000 (UTC) To: Return-Path: X-pair-Authenticated: 216.254.101.195 X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.4 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , List-Archive: Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:14241 Date: 2001-10-11T07:44:12-04:00 Why would you use a DLL for this? Creating a simple Ada COM object is easier to do in Ada and easier to use in C++! See the tutorial in GNATCOM for a detailed basic example (should be enough to get you started). In summary: 1. Create the IDL for your Ada based COM object and compile with midl.exe from VC++ 2. Run CreateCOM on the TLB that is created by midl.exe 3. Fill in the blanks in the Ada code!! 4. Compile and register object On the C++ side use #import "XXXX.dll" where XXXX.dll is the Ada COM object dll created above. MyInterfacePtr X; X.Create (__uuidof(MyObject)); X->DoMyStuff (); X = NULL; Done. http://www.adapower.com/gnatcom David Botton ----- Original Message ----- From: "Peter Hend�n" Newsgroups: comp.lang.ada To: Sent: Thursday, October 11, 2001 7:26 AM Subject: Help with GNAT, WinNT, StdCall, dll, exported names > I'm using gnat 3.13p, trying to build a dll that exports functions > that are to be called by a windows service. The problem is > that the functions are declared in the .h file as > > BOOL WINAPI Foobar(LPFUNNY_STRUCT fum); > > Now I have defined an Ada function for this, and > it works fine when I export it as > pragma Export(C, Foobar, "Foobar");. > > Of course this will be called exactly once, because > it is the wrong calling convention, and after its return > the stack is fubar. > > When I try to declare it StdCall instead of C, I am > not able to link it. Whatever I put in the .DEF file > it comes out wrong. I get from the last gnatlink step > in gnatdll: > > mydll.exp(.edata+0x34):fake: undefined reference to `Foobar' > > I have tried everything in the gnat user's guide, searched > this groups archive and generally banged my head against > the wall in appropriate - and perhaps not so appropriate - > ways. Please help! > > /Peter H. > > -- > Peter Hend�n http://www.algonet.se/~phenden > ICQ: 14672398 > Teknisk Dokumentation AB http://www.tdab.com > > > _______________________________________________ > comp.lang.ada mailing list > comp.lang.ada@ada.eu.org > http://ada.eu.org/mailman/listinfo/comp.lang.ada >