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

2014-01-18 Thread Fred van Stappen
Yep, yep, yep, i get it... I will (try) to explain the thing... The error comes mainly because i was focused on SoundTouchDLL.h. (Thanks to Ludo). That wrapper is for windows only. Before to call a DSP-buffer-procedure, you must do : FHandle := soundtouch_createInstance(); But the result of

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

2014-01-17 Thread Fred van Stappen
Hello. Thanks to Mister Hinst, i was able to load and run, in Windows, with dynlib.pas, SoundTouch.dll. Perfect and re-thanks. Now, i begin a other hard battle : load and run in Linux, libSoundTouch.so. With the extremely helpful message of Mister Ewald : Try to find the names of the symbols

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

2014-01-17 Thread Ludo Brands
On 01/17/2014 03:16 PM, Fred van Stappen wrote: I run nm and find the name of the procedures ( PS : without nm-Ewald's tip, you must be a high soothsayer to find it) For example, a C called procedure : soundtouch_getVersionString() becomes :

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

2014-01-17 Thread Fred van Stappen
I run nm and find the name of the procedures ( PS : without nm-Ewald's tip, you must be a high soothsayer to find it) For example, a C called procedure : soundtouch_getVersionString() becomes : _ZN10soundtouch10SoundTouch16getVersionStringEv() !!! The

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

2014-01-17 Thread Fred van Stappen
I only have problem with : _ZN10soundtouch10SoundTouch16getVersionStringEv()... Ooops, have to read : I only have problem with : Pointer(soundtouch_setSampleRate):= GetProcAddress(LibHandle, Pchar('_ZN10soundtouch10SoundTouch13setSampleRateEj'));

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

2014-01-17 Thread Marco van de Voort
In our previous episode, Fred van Stappen said: I have only a problem with one procedure: This c procedure is declared as this : SOUNDTOUCHDLL_API void __cdecl soundtouch_setSampleRate(HANDLE h, unsigned int srate); And i translate it like that : soundtouch_setSampleRate : procedure(h

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

2014-01-17 Thread Fred van Stappen
Subject: Re: [fpc-pascal] windows.GetProcAddress() vs DynLibs.GetProcAddress() In our previous episode, Fred van Stappen said: I have only a problem with one procedure: This c procedure is declared as this : SOUNDTOUCHDLL_API void __cdecl soundtouch_setSampleRate(HANDLE h, unsigned

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

2014-01-17 Thread Ludo Brands
On 01/17/2014 03:55 PM, Fred van Stappen wrote: I run nm and find the name of the procedures ( PS : without nm-Ewald's tip, you must be a high soothsayer to find it) For example, a C called procedure : soundtouch_getVersionString() becomes :

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

2014-01-17 Thread Fred van Stappen
On 01/17/2014 03:55 PM, Fred van Stappen wrote: I run nm and find the name of the procedures ( PS : without nm-Ewald's tip, you must be a high soothsayer to find it) For example, a C called procedure : soundtouch_getVersionString() becomes :

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

2014-01-17 Thread Marco van de Voort
In our previous episode, Fred van Stappen said: Handle is not defined on Linux. Many libraries emulate some handle type, but it depends on the vendor if they make handle 32-bit or 64-bit. Make sure that sizeof(HANDLE) in C++ matches sizeof(THandle) in FPC. Adjust the type you use at

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

2014-01-17 Thread Fred van Stappen
Writeln(sizeof(THandle)); // for console apps FHandle := soundtouch_createInstance(); writeln(FHandle); Writeln(sizeof(FHandle)); Gives that result : 10321232 4 I don't know if the Handle type in the header is defined by the C++ compiler or by the package itself. Consult their respective

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

2014-01-17 Thread Fred van Stappen
I don't know if the Handle type in the header is defined by the C++ compiler or by the package itself. Consult their respective documentation for more info. Here declaration of create instance : // Create a new instance of SoundTouch processor. SOUNDTOUCHDLL_API HANDLE __cdecl

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

2014-01-17 Thread Ludo Brands
On 01/17/2014 05:09 PM, Fred van Stappen wrote: I don't know if the Handle type in the header is defined by the C++ compiler or by the package itself. Consult their respective documentation for more info. Here declaration of create instance : // Create a new instance of SoundTouch

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

2014-01-17 Thread Ewald
On 17 Jan 2014, at 17:25, Ludo Brands wrote: On 01/17/2014 05:09 PM, Fred van Stappen wrote: I don't know if the Handle type in the header is defined by the C++ compiler or by the package itself. Consult their respective documentation for more info. Here declaration of create instance

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

2014-01-17 Thread Fred van Stappen
That routine is defined in SoundTouchDLL.cpp which is the windows dll wrapper. Do you have the linux equivalent? Ludo PS : For new new arriving : SoundTouchDLL.cpp is part of SoundTouch, a audio processing library : http://www.surina.net/soundtouch/download.html @ Ludo : In

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

2014-01-17 Thread Fred van Stappen
Yep, there is a brand new wrapper from trunk : Of course, all the tests i have done are with that new wrapper... ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

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

2014-01-17 Thread Ewald
On 17 Jan 2014, at 20:40, Fred van Stappen wrote: Yep, there is a brand new wrapper from trunk : Ha, then you use/compiled a different version. Since a `extern C` preserves the symbol name (that is the trick I use to link in a lot of external C++ code: just put extern C in front of the

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

2014-01-17 Thread Fred van Stappen
Ha, then you use/compiled a different version. Since a `extern C` preserves the symbol name (that is the trick I use to link in a lot of external C++ code: just put extern C in front of the symbol). or it could be that I am completely missing something here. [for example: is the symbol

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

2014-01-17 Thread Fred van Stappen
That routine is defined in SoundTouchDLL.cpp which is the windows dll wrapper. Do you have the linux equivalent? Oops, im full of doubt now... Do you think the SoundTouchDLL.h wrapper is for Windows only ( and, yes, the old wrapper uses stdcall (who is windows only)). And for linux how does

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

2014-01-17 Thread Ewald
On 17 Jan 2014, at 21:14, Fred van Stappen wrote: Ha, then you use/compiled a different version. Since a `extern C` preserves the symbol name (that is the trick I use to link in a lot of external C++ code: just put extern C in front of the symbol). or it could be that I am completely

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

2014-01-14 Thread Sven Barth
Am 14.01.2014 00:12 schrieb Ewald ew...@yellowcouch.org: On 13 Jan 2014, at 23:06, Fred van Stappen wrote: The SoundTouch.dll uses index to call the procedures. Like that : [Ordinal/Name Pointer] [ 0] soundtouch_clear [ 1] soundtouch_createInstance [ 2]

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

2014-01-14 Thread Marco van de Voort
In our previous episode, Sven Barth said: Maybe an overload could be added to load functions by ordinal on Windows and which simply returns Nil on other platforms. I thought the index feature originated in win3.x and was mostly considered deprecated by MS?

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

2014-01-14 Thread Sven Barth
Am 14.01.2014 12:04 schrieb Marco van de Voort mar...@stack.nl: In our previous episode, Sven Barth said: Maybe an overload could be added to load functions by ordinal on Windows and which simply returns Nil on other platforms. I thought the index feature originated in win3.x and was

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

2014-01-14 Thread Fred van Stappen
fred, can you please adjust your quoting to use the standard '' for previous responses and then add your response below? you do add your response below but the quote is the exact of the previous and it is very hard to read only your responses when the previous is not prefixed by ''...

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

2014-01-14 Thread hinst
I identified the problem Take a look at the function declaration plz: Function GetProcAddress(Lib : TlibHandle; const ProcName : AnsiString) : Pointer; // from dynlibs It internally uses this function: Function GetProcedureAddress(Lib : TLibHandle; const ProcName : AnsiString) :

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

2014-01-14 Thread Sven Barth
Am 14.01.2014 14:02 schrieb Tomas Hajny xhaj...@hajny.biz: On Tue, January 14, 2014 09:24, Sven Barth wrote: Am 14.01.2014 00:12 schrieb Ewald ew...@yellowcouch.org: On 13 Jan 2014, at 23:06, Fred van Stappen wrote: The SoundTouch.dll uses index to call the procedures. . . No,

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

2014-01-14 Thread Sven Barth
Am 14.01.2014 13:21 schrieb Fred van Stappen fi...@hotmail.com: Now, for the windows version, I don't know what underlying mechanism dynlibs uses under windows, so I'm afraid I can't really comment on that platform, except that you could try a similar approach as on linux (use symbol names

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

2014-01-14 Thread Sven Barth
Am 14.01.2014 09:24 schrieb Sven Barth pascaldra...@googlemail.com: Maybe an overload could be added to load functions by ordinal on Windows and which simply returns Nil on other platforms. I've now added an overload which is implemented for the Windows systems and returns Nil on other targets.

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

2014-01-14 Thread Michael Van Canneyt
On Tue, 14 Jan 2014, Sven Barth wrote: Am 14.01.2014 09:24 schrieb Sven Barth pascaldra...@googlemail.com: Maybe an overload could be added to load functions by ordinal on Windows and which simply returns Nil on other platforms. I've now added an overload which is implemented for the

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

2014-01-14 Thread Fred van Stappen
I identified the problem Mr Hint : you are magic... I cannot find words... 1.000 gigas of thanks ( even more...). Of course you get a big credit in uos project. Fred ___ fpc-pascal maillist -

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

2014-01-14 Thread Fred van Stappen
@ Hinst, Michael, Tomas, Mark, Lukasz, Ewald, Marco, Sven and Waldo : MANY, MANY THANKS. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

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

2014-01-13 Thread Fred van Stappen
Hello. I have a external dll. In Windows i can access perfectly the procedures with GetProcAddress() if i use Windows unit. If i use DynLibs unit, prog crash when i try to load the procedure. I prefer to use DynLibs unit because i want to use the dll for Linux too (of course with library.so).

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

2014-01-13 Thread Michael Van Canneyt
On Mon, 13 Jan 2014, Fred van Stappen wrote: Hello. I have a external dll. In Windows i can access perfectly the procedures with GetProcAddress() if i use Windows unit. If i use DynLibs unit, prog crash when i try to load the procedure. I prefer to use DynLibs unit because i want to use the

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

2014-01-13 Thread Tomas Hajny
On Mon, January 13, 2014 11:47, Fred van Stappen wrote: Hello. I have a external dll. In Windows i can access perfectly the procedures with GetProcAddress() if i use Windows unit. If i use DynLibs unit, prog crash when i try to load the procedure. I prefer to use DynLibs unit because i

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

2014-01-13 Thread Fred van Stappen
Date: Mon, 13 Jan 2014 11:58:21 +0100 From: mich...@freepascal.org To: fpc-pascal@lists.freepascal.org Subject: Re: [fpc-pascal] windows.GetProcAddress() vs DynLibs.GetProcAddress() On Mon, 13 Jan 2014, Fred van Stappen wrote: Hello. I have a external dll. In Windows i can

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

2014-01-13 Thread Michael Van Canneyt
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

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

2014-01-13 Thread Fred van Stappen
Date: Mon, 13 Jan 2014 12:07:54 +0100 From: xhaj...@hajny.biz To: fpc-pascal@lists.freepascal.org Subject: Re: [fpc-pascal] windows.GetProcAddress() vs DynLibs.GetProcAddress() On Mon, January 13, 2014 11:47, Fred van Stappen wrote: Hello. I have a external dll. In Windows i can

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

2014-01-13 Thread Mark Morgan Lloyd
Tomas Hajny wrote: On Mon, January 13, 2014 11:47, Fred van Stappen wrote: Hello. I have a external dll. In Windows i can access perfectly the procedures with GetProcAddress() if i use Windows unit. If i use DynLibs unit, prog crash when i try to load the procedure. I prefer to use DynLibs

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

2014-01-13 Thread Fred van Stappen
Date: Mon, 13 Jan 2014 12:32:53 +0100 From: mich...@freepascal.org To: fpc-pascal@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

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

2014-01-13 Thread Michael Van Canneyt
On Mon, 13 Jan 2014, Fred van Stappen wrote: Date: Mon, 13 Jan 2014 12:32:53 +0100 From: mich...@freepascal.org To: fpc-pascal@lists.freepascal.org Subject: Re: [fpc-pascal] windows.GetProcAddress() vs DynLibs.GetProcAddress() On Mon, 13 Jan 2014, Fred van Stappen wrote: Here part

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

2014-01-13 Thread Fred van Stappen
On Mon, 13 Jan 2014, Fred van Stappen wrote: Date: Mon, 13 Jan 2014 12:32:53 +0100 From: mich...@freepascal.org To: fpc-pascal@lists.freepascal.org Subject: Re: [fpc-pascal] windows.GetProcAddress() vs DynLibs.GetProcAddress() On Mon, 13 Jan 2014, Fred van Stappen wrote: Here

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

2014-01-13 Thread Michael Van Canneyt
On Mon, 13 Jan 2014, Fred van Stappen wrote: begin LibHandle:=DynLibs.LoadLibrary(libfilename);   if LibHandle DynLibs.NilHandle then         Pointer(soundtouch_createInstance)    := DynLibs.GetProcedureAddress(LibHandle, PAnsiChar('soundtouch_createInstance ')); Remove the

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

2014-01-13 Thread Fred van Stappen
On Mon, 13 Jan 2014, Fred van Stappen wrote: begin LibHandle:=DynLibs.LoadLibrary(libfilename); if LibHandle DynLibs.NilHandle then Pointer(soundtouch_createInstance):= DynLibs.GetProcedureAddress(LibHandle, PAnsiChar('soundtouch_createInstance '));

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

2014-01-13 Thread Michael Van Canneyt
On Mon, 13 Jan 2014, Fred van Stappen wrote: On Mon, 13 Jan 2014, Fred van Stappen wrote: begin LibHandle:=DynLibs.LoadLibrary(libfilename);   if LibHandle DynLibs.NilHandle then         Pointer(soundtouch_createInstance)    := DynLibs.GetProcedureAddress(LibHandle,

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

2014-01-13 Thread Lukasz Sokol
Hi, 'scue me if I did not catch something, but On 13/01/14 12:13, Fred van Stappen wrote: [...] procedure InitLib(LibFile : PAnsiChar); begin LibHandle:=DynLibs.LoadLibrary(libfilename); if LibHandle DynLibs.NilHandle then Pointer(soundtouch_createInstance):=

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

2014-01-13 Thread Fred van Stappen
On Mon, 13 Jan 2014, Fred van Stappen wrote: On Mon, 13 Jan 2014, Fred van Stappen wrote: begin LibHandle:=DynLibs.LoadLibrary(libfilename); if LibHandle DynLibs.NilHandle then Pointer(soundtouch_createInstance):=

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

2014-01-13 Thread Fred van Stappen
To: fpc-pascal@lists.freepascal.org From: el.es...@gmail.com Date: Mon, 13 Jan 2014 12:52:51 + Subject: Re: [fpc-pascal] windows.GetProcAddress() vs DynLibs.GetProcAddress() Hi, 'scue me if I did not catch something, but On 13/01/14 12:13, Fred van Stappen wrote

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

2014-01-13 Thread Fred van Stappen
To: fpc-pascal@lists.freepascal.org From: el.es...@gmail.com Date: Mon, 13 Jan 2014 12:52:51 + Subject: Re: [fpc-pascal] windows.GetProcAddress() vs DynLibs.GetProcAddress() Hi, 'scue me if I did not catch something, but On 13/01/14 12:13, Fred van Stappen wrote

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

2014-01-13 Thread Lukasz Sokol
On 13/01/14 13:36, Fred van Stappen wrote: [...] Hello Lucaz /// why not just : @soundtouch_createInstance := DynLibs.GetProcedureAddress(LibHandle, PAnsiChar('soundtouch_createInstance')); Get that error : libSoundTouch.pas(56,5) Error: Can't assign values to an address This

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

2014-01-13 Thread Fred van Stappen
From: fi...@hotmail.com To: fpc-pascal@lists.freepascal.org Date: Mon, 13 Jan 2014 17:33:47 +0100 Subject: Re: [fpc-pascal] windows.GetProcAddress() vs DynLibs.GetProcAddress() Hello and many thanks to help. Here demo to show the problem (i hope). https://sites.google.com/site

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

2014-01-13 Thread Ewald
On 13 Jan 2014, at 17:33, Fred van Stappen wrote: Hello and many thanks to help. Here demo to show the problem (i hope). https://sites.google.com/site/fiensprototyping/dynlib_vs_windows.zip in the dynlibs version, why do you use `PChar(1)` or `PChar(2)` [or ] instead of the name

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

2014-01-13 Thread Fred van Stappen
From: ew...@yellowcouch.org Date: Mon, 13 Jan 2014 21:25:27 +0100 To: fpc-pascal@lists.freepascal.org Subject: Re: [fpc-pascal] windows.GetProcAddress() vs DynLibs.GetProcAddress() On 13 Jan 2014, at 17:33, Fred van Stappen wrote:Hello and many thanks to help. Here demo to show the problem (i

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

2014-01-13 Thread Ewald
On 13 Jan 2014, at 23:06, Fred van Stappen wrote: The SoundTouch.dll uses index to call the procedures. Like that : [Ordinal/Name Pointer] [ 0] soundtouch_clear [ 1] soundtouch_createInstance [ 2] soundtouch_destroyInstance That explains why it works in windows

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

2014-01-13 Thread waldo kitty
fred, can you please adjust your quoting to use the standard '' for previous responses and then add your response below? you do add your response below but the quote is the exact of the previous and it is very hard to read only your responses when the previous is not prefixed by ''... thanks!