<div dir="ltr">On Fri, Jul 15, 2011 at 14:43, Bernd <span dir="ltr"><<a href="mailto:prof7bit@googlemail.com">prof7bit@googlemail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I am just trying to convert some openssl headers to Pascal (I know<br>
that there is an openssl unit in the fpc packages but it is missing<br>
the ECDSA functions which I will need later and which is main reason I<br>
am starting to look into openssl).<br>
<br>
To get used to this entire thing I am beginning with something much<br>
more simple, I will try to get some sha hashing functions from openssl<br>
imported (I will also need them, so it would not hurt to start with<br>
them).<br>
<br>
I am referring to the header file /usr/include/openssl/sha.h (pastebin<br>
here: <a href="http://pastebin.com/dS8DY2z9" target="_blank">http://pastebin.com/dS8DY2z9</a> )<br>
<br>
After appyling h2pas i have the following: <a href="http://pastebin.com/v3S3vtFR" target="_blank">http://pastebin.com/v3S3vtFR</a><br>
<br>
If I want to import functions in Pascal I would either declare them<br>
external and explicitly tell it the name of the library binary (this<br>
seems straightforward to me, I see no problems with this) or I load it<br>
dynamically at runtime and then ask for the addresses of the functions<br>
that I need and assign them to procedure variables (I have also done<br>
this already on some occasions and it is equally easy to understand<br>
and also raises no questions).<br>
<br>
I am confused about something else:<br>
<br>
When looking at the .h file and also when looking at the generated .pp<br>
file it seems that nowhere in the header there was any information<br>
about which .so (or .dll) to load or link against. It created empty<br>
bodies with { you must implement this function }. Now the question<br>
(and I am intentionally asking this on a Pascal list and not a C list<br>
to get an answer that better fits into my Pascal brain) how would the<br>
C compiler or linker know from where exactly to import these<br>
functions? Where is this information, how are these C folks doing<br>
these things, what kind of magic have they going on?<br></blockquote><div><br>The information is located under /usrlib/pkgconfig/openssl.pc <br><br>It tells to the configure script how to generate the Makefile and how to link stuff. It just a gcc syntax that is pasted back to the Makefile.<br>
<br>I wrote a tool once (in Bash) that allow you properly search for a function inside an so to see who have it.<br>If you wish, you can find it here: <a href="http://code.google.com/p/pasxlibbind/source/browse/trunk/find_function.sh">http://code.google.com/p/pasxlibbind/source/browse/trunk/find_function.sh</a><br>
<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
confused,<br>
<font color="#888888">Bernd<br>
_______________________________________________<br>
fpc-pascal maillist - <a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a><br>
<a href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal" target="_blank">http://lists.freepascal.org/mailman/listinfo/fpc-pascal</a><br>
</font></blockquote></div><br><br>Ido<br></div>