[fpc-pascal] windows.GetProcAddress() vs DynLibs.GetProcAddress()

Fred van Stappen fiens at hotmail.com
Mon Jan 13 12:54:45 CET 2014


Date: Mon, 13 Jan 2014 12:32:53 +0100
From: michael at freepascal.org
To: fpc-pascal at lists.freepascal.org
Subject: Re: [fpc-pascal] windows.GetProcAddress() vs DynLibs.GetProcAddress()

 
 
On Mon, 13 Jan 2014, Fred van Stappen wrote:
 
> 
> >>> Here part of NOT working code (if i call soundtouch_createInstance, it crash)
> ...
> uses  
> dynlibs ;
> ...
> 
> var
> soundtouch_createInstance : function() : THandle; stdcall; 
> 
> ...
> 
> procedure InitLib(LibFile : PAnsiChar);
> begin
> LibHandle:=DynLibs.LoadLibrary(libfilename);
>   if LibHandle <> DynLibs.NilHandle then
>    
>     Pointer(soundtouch_createInstance)        := DynLibs.GetProcedureAddress(LibHandle, PAnsiChar('soundtouch_createInstance'));
 
Remove the typecast PansiChar()
 
Michael.

>> Hello Michael and thanks for answer.
But if i remove PansiChar(), i still get :

An unhandled exception occurred at $0000000000000000:
EAccessViolation: Access violation
  $0000000000000000



_______________________________________________
fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20140113/46a5dd1d/attachment.html>


More information about the fpc-pascal mailing list