Re: [Pharo-users] uFFI ExternalAddress challenges

2019-09-21 Thread eftomi
Hi, as a wrap-up for this forum thread, I found an elegant way to take a result as C wchar_t* from an FFI call on Windows, based on the idea of ExternalData>>#fromCString. If anybody needs it: https://github.com/eftomi/pharo-uFFI-readWin32WideString. Best wishes, Tomaz -- Sent from: http://fo

Re: [Pharo-users] uFFI ExternalAddress challenges

2019-09-18 Thread eftomi
Hi, after some more investigation the easiest way to get Win32WideString from external module is to pass it as a parameter, like in: ^self ffiCall: #( void myFunction ( Win32WideString aWin32WideString ) ) and the external module can access it directly to do r/w. There are other possibilities

Re: [Pharo-users] uFFI ExternalAddress challenges

2019-09-17 Thread Tomaž Turk
Hi, > I don’t know if there is support for that (I don’t have the time to check it in detail now). > But, as a workaround, you may try > > - return a void* > > myFunction >^self ffiCall: #(void* myFunction ( void ) ) > > - and then do the transformation yourself using Win32WideStrin

Re: [Pharo-users] uFFI ExternalAddress challenges

2019-09-17 Thread Stephan Eggermont
Tomaž Turk wrote: > OK, great, I'll try it out. Hi Tomaž, What you are discovering here would be very useful as a section/chapter in the uFFI booklet. Just posting it as text here will do if you don’t feel up to translating to Pillar. Cheers Stephan

Re: [Pharo-users] uFFI ExternalAddress challenges

2019-09-17 Thread Tomaž Turk
OK, great, I'll try it out. Thanks, Tomaz -- Original Message -- From: "Guillermo Polito" To: "Tomaž Turk" Sent: 17.9.2019 11:56:21 Subject: Re: [Pharo-users] uFFI ExternalAddress challenges I don’t know if there is support for that (I don’t have the time t

Re: [Pharo-users] uFFI ExternalAddress challenges

2019-09-17 Thread Guillermo Polito
f.uni-lj.si <mailto:tomaz.t...@ef.uni-lj.si>; > pharo-users@lists.pharo.org <mailto:pharo-users@lists.pharo.org> > Cc: "Any question about pharo is welcome" <mailto:pharo-users@lists.pharo.org>> > Sent: 12. 09. 2019 12:07:34 > Subject: Aw: Re: [Pharo-user

Re: [Pharo-users] uFFI ExternalAddress challenges

2019-09-17 Thread eftomi
It seems that there's nothing wrong with the primitive, but with Win32Variant creation in ExternalStructure class>>fromHandle:, specifically with basicNew and Win32Variant class as receiver. In what circumstances the debugger/inspector shows 'error printing' message (on the result of basicNew)?

Re: [Pharo-users] uFFI ExternalAddress challenges

2019-09-16 Thread eftomi
A rudimentary disphelper library "approach" is working OK, I succeeded to create a connection to SQL Server through ADODB, too, which is rather cool, since I've been looking for this functionality for too long. I re-checked Pablo's pharo-com package and it is rather comprehensive - it successfull

Re: [Pharo-users] uFFI ExternalAddress challenges

2019-09-13 Thread Tomaž Turk
t wishes, Tomaz -- Original Message -- From: "Torsten Bergmann" To: tomaz.t...@ef.uni-lj.si; pharo-users@lists.pharo.org Cc: "Any question about pharo is welcome" Sent: 12. 09. 2019 12:07:34 Subject: Aw: Re: [Pharo-users] uFFI ExternalAddress challenges From your s

Re: [Pharo-users] uFFI ExternalAddress challenges

2019-09-12 Thread Tomaž Turk
> Maybe you should have a look at: https://github.com/tesonep/pharo-com Thanks for the link, I'll check it out - that's probably the work Steph has mentioned. Best wishes, Tomaz

Re: [Pharo-users] uFFI ExternalAddress challenges

2019-09-12 Thread Ben Coman
On Thu, 12 Sep 2019 at 18:08, Torsten Bergmann wrote: > From your snippets it looks like you want to do COM Automation on Windows. > > Maybe you should have a look at: https://github.com/tesonep/pharo-com > Does that by chance include an implementation of "MS-CFB" Microsoft Compound File Binary

Re: [Pharo-users] uFFI ExternalAddress challenges

2019-09-12 Thread Torsten Bergmann
Betreff: Re: [Pharo-users] uFFI ExternalAddress challenges > We are interested in it :) > If I recall well Pablo got one version somewhere.   Me too :-)  Unfortunately, I only have time for 'weekend' projects, and any help is appreciated :-)   Regarding the uFFI calls, is it p

Re: [Pharo-users] uFFI ExternalAddress challenges

2019-09-12 Thread Tomaž Turk
> We are interested in it :) > If I recall well Pablo got one version somewhere. Me too :-) Unfortunately, I only have time for 'weekend' projects, and any help is appreciated :-) Regarding the uFFI calls, is it possible to pass Win32WideString in a similar fashion as a String - or where to

Re: [Pharo-users] uFFI ExternalAddress challenges

2019-09-11 Thread Tomaž Turk
Excellent, thanks!

Re: [Pharo-users] uFFI ExternalAddress challenges

2019-09-11 Thread Guillermo Polito
> El 11 sept 2019, a las 11:43, Tomaž Turk escribió: > > > Well, the pointer survives, the area of memory pointed by that pointer > > will be recycled with subsequent calls in general. > > I'll pay special attention to that, but it's probably a matter of properly > creating and releasing CO

Re: [Pharo-users] uFFI ExternalAddress challenges

2019-09-11 Thread Tomaž Turk
> Well, the pointer survives, the area of memory pointed by that pointer will be recycled with subsequent calls in general. I'll pay special attention to that, but it's probably a matter of properly creating and releasing COM objects. I have another question - in FFI call, how would one sen

Re: [Pharo-users] uFFI ExternalAddress challenges

2019-09-11 Thread Guillermo Polito
> El 11 sept 2019, a las 11:07, Tomaž Turk escribió: > > Hi, thanks for your quick reply. no problem ;) > I found the culprint while writing this email :-) Cool! > > Generally, what I'm trying to do is to make a very basic package to create > and communicate with COM components on Windows

Re: [Pharo-users] uFFI ExternalAddress challenges

2019-09-11 Thread Tomaž Turk
s - but it works as expected. Thanks again and best wishes, Tomaz -- Original Message -- From: "Guillermo Polito" To: "Tomaž Turk" ; "Any question about pharo is welcome" Sent: 11. 09. 2019 10:29:34 Subject: Re: [Pharo-users] uFFI ExternalAddress chal

Re: [Pharo-users] uFFI ExternalAddress challenges

2019-09-11 Thread Guillermo Polito
Hi Thomas, Can you share more about the definition of your CallMethod function in C? From the uFFI point of view the binding looks ok… How are you opening Pharo? From the command line or the pharo launcher? Are you on cygwin/mingw? One other possibility (since you’re playing with C libraries) i

[Pharo-users] uFFI ExternalAddress challenges

2019-09-10 Thread Tomaž Turk
Dear all, I'm struggling with passing an ExternalAddress to a c function call with uFFI. Firstly, I get the ExternalAddress from this method: myFFI>>create: aString ^ self ffiCall: #(void * CreateObject (String aString) ) [in c: void* CreateObject(char* szProgId)] The method that