On Friday, 29 January 2016 at 01:47:11 UTC, Mike Parker wrote:
On Thursday, 28 January 2016 at 19:49:22 UTC, Taylor Hillegeist
wrote:
On Thursday, 28 January 2016 at 19:33:22 UTC, bearophile wrote:
FreeSlave:
On Thursday, 28 January 2016 at 08:15:38 UTC, FreeSlave wrote:
Not directly. You can declare cdecl function on Free Pascal
side and call it as extern(C).
What about extern(Pascal)?
https://dlang.org/spec/attribute.html#linkage
Bye,
bearophile
Cool!, I did find this little gem. but still havent gotten a
hello world to work. I need to figure out which libraries i
need to include for fpc dependencies.
AFAIK, FreePascal does not use the pascal calling convention by
default. If this page [1] is correct, the default convention is
'register' and can be changed to something else (like pascal or
cdecl) with a command-line switch [2].
[1] http://www.freepascal.org/docs-html/prog/progse22.html
[2] http://www.freepascal.org/docs-html/prog/progsu87.html
Working through a simple example. I tried the cdecl option but
for some reason i can compile but when i run my Gethello it cant
find the shared library in the same folder?
====================================================================
taylor@taylor-NE510:~/Projects/PASCAL$ ls
Gethello Gethello.d hello.pas libhello.so
taylor@taylor-NE510:~/Projects/PASCAL$ cat Gethello.d
extern(C) void SubStr();
void main(){
SubStr();
}
taylor@taylor-NE510:~/Projects/PASCAL$ cat hello.pas
library subs;
procedure SubStr(); cdecl;
begin
write('hello World');
end;
exports
SubStr;
end.
taylor@taylor-NE510:~/Projects/PASCAL$ nm libhello.so
0000000000003ac0 T SubStr
taylor@taylor-NE510:~/Projects/PASCAL$ ./Gethello
./Gethello: error while loading shared libraries: libhello.so:
cannot open shared object file: No such file or directory
=======================================================================