Want to run C code in Pharo using UFFI
Hello There i am new to Pharo, so as i learn UFFI can handle c code, but i want to know that, how to run below attached code using UFFI. #include<stdlib.h> #include<stdio.h> int main( void ) { int result ; result=system("D:/DEV_FreeCAD/build/bin/box.step"); printf("%d",result); return 0; } So if anyone have idea please share with me. It will be a great help to me. Thanks for your kind help -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
Hi, as far as I know UFFI can call DLLs, that means that your code should be compiled and linked into a DLL. So maybe the line to pursue is to look for a C interpreter (like in https://stackoverflow.com/questions/584714/is-there-an-interpreter-for-c) and call it via UFFI. Best wishes, Tomaz
hello that means i need to create a ddl file and copy that file to pharo folder than try to run the command directly using UFFI like system("D:/DEV_FreeCAD/build/bin/box.step") is it what u are trying to say @TOMAZ Thanks by Shawon -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
OK - maybe I misunderstood your original question - the purpose of UFFI is to call functions in DLLs outside Pharo, so yes, if you would like to call that kind of function, you have to build a DLL. The usage of UFFI is well described in its booklet: https://books.pharo.org/booklet-uffi/. Best wishes Tomaz
participants (2)
-
shawon58 -
Tomaž Turk