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,e68e37dea4572ced X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-01-11 18:54:40 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!peer01.cox.net!cox.net!bigfeed.bellsouth.net!bignumb.bellsouth.net!news.bellsouth.net!bignews3.bellsouth.net.POSTED!84c79386!not-for-mail From: "David C. Hoos" Newsgroups: comp.lang.ada References: Subject: Re: LoadLibrary problem MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-2" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Message-ID: X-Trace: bhmkggakljkaanefdbdpiflmbcekedmfhojhikkbagflhcboepjeacnnibgeebappccidokcdolidifdmjnennlenabomgiljjghnelkageagdaebdbkbjhaojofjfmepjleminflolgbbopafnomcgoligcnnbb NNTP-Posting-Date: Sun, 11 Jan 2004 21:51:57 EST Date: Sun, 11 Jan 2004 20:54:29 -0600 Xref: archiver1.google.com comp.lang.ada:4346 Date: 2004-01-11T20:54:29-06:00 List-Id: The mistake is that you need to tell the linker where to find the file that contains the "LoadLibrary" object code. If you use the Win32ada library, it's found in libole32.a. What's more, instead of writing your own interface, you can use the imports provided in the win32-winbase.ads file, viz.: pragma Import(Stdcall, LoadLibraryA, "LoadLibraryA"); -- winbase.h:3619 pragma Import(Stdcall, LoadLibraryW, "LoadLibraryW"); -- winbase.h:3625 pragma Import(Stdcall, LoadLibraryExA, "LoadLibraryExA"); -- winbase.h:3637 pragma Import(Stdcall, LoadLibraryExW, "LoadLibraryExW"); -- winbase.h:3645 Also, note that the C calling convention is not the proper convention for use with Win32 libraries. I hope this helps "Szymon Guz" wrote in message news:Xns946DEEAEE1E18Szymon.Guz@193.110.122.80... > Hi, > I keep on trying to load a dll library using for that the WinApi > function LoadLibrary. > > > with Interfaces.C; > > > procedure Lib is > package C renames Interfaces.C; > use type C.Char_Array; > > function LoadLib ( > Library : in C.Char_Array ) > return C.Int; > > pragma Import(C,LoadLib,"LoadLibrary"); > > Handle : C.Int; > > > > begin > Handle:=LoadLib("a"); > end Lib; > > > I still get the linker error: > ./Lib.o(.text+0x12):Lib.adb: undefined reference to `LoadLibrary' > > Where is the mistake ? > > I'm using gnat and AdaGIDE under Windows98. > > -- > Szymon Guz > _______________________________________________ > comp.lang.ada mailing list > comp.lang.ada@ada-france.org > http://www.ada-france.org/mailman/listinfo/comp.lang.ada > >