jemc changed the topic of #ponylang to: Welcome! Please check out our Code of Conduct => https://github.com/ponylang/ponyc/blob/master/CODE_OF_CONDUCT.md | Public IRC logs are available => http://irclog.whitequark.org/ponylang
montanonic has quit [Ping timeout: 244 seconds]
montanonic has joined #ponylang
amclain has quit [Quit: Leaving]
montanonic has quit [Ping timeout: 252 seconds]
TwoNotes has quit [Quit: Leaving.]
<triangle345> hey guys if I wanted to pass a pointer to a windows function how would i do it? I tried to pass in [Pointer[_myprimitive]] but didnt work
c355e3b has quit [Quit: Connection closed for inactivity]
montanonic has joined #ponylang
montanonic has quit [Ping timeout: 276 seconds]
Praetonus has quit [Quit: Leaving]
triangle345 has quit [Ping timeout: 264 seconds]
jemc has joined #ponylang
hewsut has joined #ponylang
hewsut has quit [Quit: receive...do... zZzz...]
montanonic has joined #ponylang
jemc has quit [Ping timeout: 265 seconds]
zaquest has joined #ponylang
montanonic has quit [Ping timeout: 264 seconds]
montanonic has joined #ponylang
dinfuehr has joined #ponylang
dinfuehr_ has quit [Ping timeout: 240 seconds]
Praetonus has joined #ponylang
montanonic has quit [Ping timeout: 252 seconds]
c355e3b has joined #ponylang
nyon has joined #ponylang
nyon has quit [Client Quit]
triangle345 has joined #ponylang
<triangle345> hey anyone feel like helping me out with some windows ffi issues?
<triangle345> :)
<doublec> triangle345: sure
<triangle345> haha hey doublec how you doing
<triangle345> this is a similar but different issue
<triangle345> so i'm trying to make createprocess work https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
<triangle345> im obviously now using createprocessA for ascii version
<triangle345> im setting everything to U8(0) except for the last two values (processinfo) and (startupinfo) which i have as primitives
<triangle345> like so
<triangle345> var pi:Pointer[_PROCESSINFORMATION] = Pointer[_PROCESSINFORMATION] var si:Pointer[_STARTUPINFO] = Pointer[_STARTUPINFO]
<triangle345> which then i go like so:
<triangle345> @CreateProcessA[Bool]( U8(0), // No module name (use command line) "notepad.exe".cstring(), // Command line U8(0), // Process handle not inheritable U8(0), // Thread handle not inheritable false, // Set handle inheritance to FALSE U32(0), // No creation flags U8(0), // Use parent's environment block U8(0),
<triangle345> wondering if I'm passing in the pointer properly the way pony intended?
<doublec> I think it got chopped off
<triangle345> let me put it up on pastebin
<doublec> But that last parameter, being an out parameter, should use addressof
<triangle345> addressof the primitive right?
<triangle345> or do i need actual structs?
<doublec> triangle345: addressf the actual struct
* doublec looks for an example
<triangle345> i have a working example
<triangle345> let me put it up on pastebin
<triangle345> for c
<triangle345> this is my working c example
<doublec> So you need to map the C structures for STARTUPINFO and PROCESS_INFORMATION info Pony objects
<triangle345> oh man
<doublec> One way is describe here, using tuples: https://tutorial.ponylang.org/c-ffi/calling-c.html
<triangle345> startup info is huge lol
<triangle345> so i tried doing that as well.. let me paste how i mapped them
<doublec> Another way is using 'Struct'
prettyvanilla has quit [Remote host closed the connection]
<triangle345> yep
<triangle345> exactly what i did
prettyvanilla has joined #ponylang
<doublec> Ah, good
<triangle345> atleast the way with the primitives it crashes but with these structs i get nothing
<doublec> so then: var si: Startupinfo
<doublec> and pass to CreateProcessas: addressof si
<triangle345> nothing happens
<triangle345> no crash or anything
<Praetonus> triangle345: What is the parameter declaration in C?
<triangle345> addressof si,
<triangle345> var si:StartupInfo = StartupInfo
<triangle345> maybe i messed up some type mapping in that struct?
<Praetonus> addressof somestruct yields a somestruct** in C
<doublec> Hmm, is it MaybePointer that is needed?
<Praetonus> If the C parameter is a pointer to a struct, you shouldn't use addressof in Pony
<Praetonus> Just pass the struct as is
<Praetonus> doublec: MaybePointer is needed for C functions returning potentialy NULL pointers
<doublec> Praetonus: C func is taking a SomeStruct*
<doublec> Praetonus: so looks like you're right about just passing the struct var
<triangle345> yea still nothing
<triangle345> same result
<doublec> triangle345: So no crash, just createprocess not doing what you expect?
<triangle345> its doing nothing , yea
<triangle345> so startupinfo struct in c
<triangle345> has stuff like lpcstr(constant string)
<triangle345> and handle
<triangle345> in pony can i just zero those out with U8?
<triangle345> or do i actually need Ponter[U8] for string?
<triangle345> and for handle
<triangle345> handle is like a void*
<doublec> Have you mapped the structures correctly?
<doublec> triangle345: you have lpReserved2 as an U8, but it's a pointer in the C structure
<triangle345> right so i thought i would just zero it out
<triangle345> with U8 zero
<doublec> triangle345: So in your structure it's size 1 byte, in the real structure it's size of a pointer
<doublec> ditto with the handles
<triangle345> lpbyte is just a pointer to a byte
<triangle345> so all of that would get mapped to Pointer[U8] in pony?
<doublec> I assume that works in Pony struct definitions
* doublec doesn't really know
<doublec> You also need to set the 'cb' member of the structure to its size
<doublec> Try calling GetLastError to find out why createprocess if failing
<triangle345> thats a good point
<triangle345> will def try that.
<triangle345> well i need to head out to work.. thanks a ton for your help
<doublec> I suspect it's errors in the structure setup
<doublec> np
<doublec> good luck!
triangle345 has quit [Ping timeout: 264 seconds]
hewsut has joined #ponylang
<Candle> doublec: You were asking about package management for pony the other day: https://github.com/CandleCandle/pony-maven-plugin / http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22pony-maven-plugin%22
<doublec> Candle: nice, I'll give it a try
<Candle> doublec: Certainly has rough edges and missing bits. I should get issue #2 done this weekend.
trapped has joined #ponylang
jemc has joined #ponylang
tm-exa has joined #ponylang
pyon has quit [Remote host closed the connection]
pyon has joined #ponylang
TwoNotes has joined #ponylang
<TwoNotes> No crashes yet on ARM regarding issue #1000
<Praetonus> Great
amclain has joined #ponylang
runehog has quit [Remote host closed the connection]
<jemc> cool!
<TwoNotes> So is the mutex gone now, replaced by just proper atomic ops?
<Praetonus> Yes, no mutex here
runehog has joined #ponylang
Matthias247 has joined #ponylang
tm-exa has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
montanonic has joined #ponylang
tm-exa has joined #ponylang
tm-exa has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pyon has quit [Quit: brb]
trapped has quit [Ping timeout: 276 seconds]
pyon has joined #ponylang
toblux has joined #ponylang
runehog has quit [Read error: Connection reset by peer]
runehog has joined #ponylang
TwoNotes has quit [Remote host closed the connection]
runehog has quit [Ping timeout: 276 seconds]
Praetonus has quit [Quit: Leaving]
toblux has quit []
runehog has joined #ponylang
Matthias247 has quit [Read error: Connection reset by peer]
hewsut has quit [Quit: receive...do... zZzz...]
hewsut has joined #ponylang