<p>Am 14.01.2014 00:12 schrieb "Ewald" <<a href="mailto:ewald@yellowcouch.org">ewald@yellowcouch.org</a>>:<br>
><br>
><br>
> On 13 Jan 2014, at 23:06, Fred van Stappen wrote:<br>
><br>
>> The SoundTouch.dll uses index to call the procedures.<br>
>><br>
>> Like that :<br>
>> [Ordinal/Name Pointer]<br>
>> [ 0] soundtouch_clear <br>
>> [ 1] soundtouch_createInstance <br>
>> [ 2] soundtouch_destroyInstance<br>
>><br>
><br>
> That explains why it works in windows probably, there you can specify an index to go with your exported procedures IIRC. I don't know if this is possible though on *nix.</p>
<p>No, ordinals are not supported on non-Windows (or more precisely non-PE) systems.</p>
<p>><br>
>> >> try `GetProcAddress(LibHandle, 'soundtouch_clear');<br>
>><br>
>> I have try that, but it does not work...`<br>
>><br>
><br>
> What is the result of the call (GetProcAddress)? nil? if so then try to find the names of the symbols defined in the shared object (nm comes to mind).<br>
><br>
> 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 instead of indices). OTOH it could (?) be that the the compiler inserts code to typecast PChar(1) to a string, which could result in an access violation (try `var a: string; a:= pchar(1);` to try it out ;-) ).</p>
<p>The Windows version of dynlibs directly uses the Windows functions. The only difference is that it takes an AnsiString as argument and thus one can't pass an ordinal value.</p>
<p>Maybe an overload could be added to load functions by ordinal on Windows and which simply returns Nil on other platforms.</p>
<p>Regards,<br>
Sven</p>