<div><div dir="auto">Can i just write a simple C shared library or DLL which calls the C++ ? So you are repackaging the C++ as a C library? I can’t see how this tack could fail to work. Just repackage C++ as C. </div><div dir="auto"><br></div><div dir="auto">You would have to come up with a procedural less OOP-ish API i guess.  You could have C API functions F which take an Object as F’s first input and in this way each C++ Method becomes a C function. You only need wrap as much of the C++ API as you want to use and each C function just calls its C++ Method so making the wrappers is highly simple and mechanical i should think. it could even be automated. But i know some C++ but have never made anything in it. </div><div dir="auto"><br></div><div dir="auto">I suppose that if Smalltalk cannot contain a C++ Object then you could make a C struct which can be in Smalltalk and you have the API function copy this struct into the C++ Object then act on it then copy the Object data back into the struct which is in Smalltalk. But that’s a lot of work. Surely you can have a pointer to a C++ Object in Smalltalk. </div><div dir="auto"><br></div><div dir="auto">Maybe it would be better to have a separate C++ program P that you communicate with by sockets using Object handles H which are just Integer Array indexes into an Array of Objects in P? i suppose there could be a shared lib L that FFI could call which could call back program P if sockets were too slow or something. </div><div dir="auto"><br></div><div dir="auto">I guess Dolphin can  input a Smalltalk BlockClosure B into an FFI call to L which could input B into program P which could call B to get back into Dolphin but i haven’t tried it myself. </div><div dir="auto"><br></div><div dir="auto">I guess there is a Smalltalk interface to Python via a socket and then from Python to C++ is easy? Seems like a code generator that has all this stuff figured out could be good. I think VisualWorks is probably good at connecting to C++ via FFI. What about chicken scheme or any of the C based Schemes? What about Smalltalk/X? </div><div dir="auto"><br></div><div dir="auto">borgLisp is an idea to make multiple Lisp dialects each isomorphic to its target language like C or C++ or Python or Ruby or Prolog or java or C# or Scheme or Rust etc any language can have an isomorphic Lisp dialect targeting it in order to bind all the languages into a single borgLisp where you can mix and match all the languages together. Where each Lisp dialect is just a simple Lisp code generator. And so once all the languages are in Lisp then all the Lisp things can be used to mix and match all the languages together and using Nix to set up and configure everything so everything works together one click like. all the different languages. so they can all work together in an easy generative format. So every language becomes Lisp and Lisp becomes every language. Using code generation you could even make a Debugger in Lisp and Smalltalk which could source debug any language like the Smalltalk debugger does for Smalltalk.</div></div><div dir="auto"><br></div><div dir="auto">but i guess this is off the topic</div><div><br><div class="gmail_quote"><div dir="ltr">On Fri, Nov 2, 2018 at 06:07 Ben Coman <<a href="mailto:btc@openinworld.com">btc@openinworld.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Fri, 2 Nov 2018 at 18:44, Edwin Ancaer <<a href="mailto:eancaer@gmail.com" target="_blank">eancaer@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hello list, <br></div><div><br></div><div>As I'm looking at a way to automate the search of documents in my humble administration, I read some articles about OCR. I came along an article about using Python with Tesseract, to transform an scan of a document into text, that is searchable. <br></div><div><br></div><div>My question now is if I can do something similar with Squeak. To my inexperienced eye, it seems like I should use FFI to call the functions in the Tesseract API, but this API is in  C++, and I don't know if it is possible to use FFI to call C++ functions?</div></div></blockquote><div><br></div><div>You are right C++ is difficult because of the name mangling of function symbols, </div><div>but good fortune I notice Tesseract has C bindings...</div><div>    <a href="https://github.com/tesseract-ocr/tesseract#for-developers" target="_blank">https://github.com/tesseract-ocr/tesseract#for-developers</a><br></div><div>    <a href="https://github.com/tesseract-ocr/tesseract/blob/master/src/api/capi.h" target="_blank">https://github.com/tesseract-ocr/tesseract/blob/master/src/api/capi.h</a></div><div>so it looks like you are in the clear.</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Or should I forget the API and use OSProcess to start the tesseract program? <br></div></div></blockquote><div><br></div><div>FFI will be more flexible.</div><div> </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div><div>Could anyone point me in the right direction, or just tell  if the whole idea is insane?<br></div></div></blockquote><div><br></div><div>I think its a great idea and actually Tesseract FFI is something I've wanted to play with before but not had the time.</div><div>I'd be interested to hear how you go with it.</div><div><br></div><div>cheers -ben</div></div></div></div></div>
<br>
</blockquote></div></div>