<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><br><div>> Date: Mon, 13 Jan 2014 11:58:21 +0100<br>> From: michael@freepascal.org<br>> To: fpc-pascal@lists.freepascal.org<br>> Subject: Re: [fpc-pascal] windows.GetProcAddress() vs DynLibs.GetProcAddress()<br>> <br>> <br>> <br>> On Mon, 13 Jan 2014, Fred van Stappen wrote:<br>> <br>> > Hello.<br>> > <br>> > I have a external dll. In Windows i can access perfectly the procedures with<br>> > GetProcAddress() if i use Windows unit.<br>> > <br>> > If i use DynLibs unit, prog crash when i try to load the procedure.<br>> > I prefer to use DynLibs unit because i want to use the dll for Linux too (of course with library.so).<br>> > <br>> > I have try, in linux to access the procedure with DynLibs too but same crash than for Windows.<br>> > What must i do to access procedure with DynLibs ?<br>> <br>> Can you be more specific ? What error do you get ? Can show some code ?<br>> <br>> Michael.<br><br>Hello and many thanks for answer.<br><br>The library is SoundTouch.dll and libSoundTouch.so from :<br><br>>> http://www.surina.net/soundtouch/<br><br>>>>Here part of working code (if i call soundtouch_createInstance, it works)<br>...<br>uses <br>Windows ;<br>...<br><br>var<br>soundtouch_createInstance : function() : THandle; stdcall; <br><br>... <br><br>procedure InitLib(LibFile : PAnsiChar);
<br>begin
<br> LibHandle := LoadLibrary(LibFile);
<br> if LibHandle <> 0 then
<br> Pointer(soundtouch_createInstance) := GetProcAddress(LibHandle, PAnsiChar('soundtouch_createInstance'));<br><br>/////////////////////<br><br>>>> Here part of NOT working code (if i call soundtouch_createInstance, it crash)<br>...<br>uses <br>dynlibs ;<br>...<br><br>var<br>soundtouch_createInstance : function() : THandle; stdcall; <br><br>... <br><br>procedure InitLib(LibFile : PAnsiChar);
<br>begin
<br>LibHandle:=DynLibs.LoadLibrary(libfilename);
<br> if LibHandle <> DynLibs.NilHandle then
<br> <br> Pointer(soundtouch_createInstance) := DynLibs.GetProcedureAddress(LibHandle, PAnsiChar('soundtouch_createInstance')); <br><br>/////////////////////<br><br>Many thanks.<br><br><br></div> </div></body>
</html>