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
amclain has quit [Quit: Leaving]
Praetonus has quit [Quit: Leaving]
triangle345 has joined #ponylang
<triangle345> hey all i'm having some trouble running FFI on simple windows commands such as: @ShellExecute[U32](U32(0), "open".cstring(), "cmd.exe".cstring(), "/C ipconfig > out.txt".cstring(), U32(0), U32(0))
<triangle345> keeps giving me error LNK2019: unresolved external symbol ShellExecute referenced in function Main_Dispatch
jemc_ has quit [Ping timeout: 244 seconds]
<triangle345> does anyone know if I have to manually include a windows header or something somewhere?
<doublec> triangle345: you probably need to link against a windows library somehow
<doublec> triangle345: do you have a: use "lib:somelibraryname" in your program?
<doublec> (which is what handles the linking)
<doublec> triangle345: possible: use "lib:shell32"
jemc_ has joined #ponylang
c355e3b has quit [Quit: Connection closed for inactivity]
<triangle345> thanks i will give that a try
<doublec> np
<triangle345> hmm still having same issue
<triangle345> do i need to the have dll in the current path?
<triangle345> no that didnt work either
<doublec> odd
<doublec> hmm, I wonder if there's some name mangling thing going on
<doublec> istr that win32 functions use pascal linkage or something like that
<doublec> Yes, they use stdcall
<doublec> I don't know if there's a way to specify that, hopefully a pony dev can help
<triangle345> right, well thanks for the help
<doublec> triangle345: you might be able to use @system though on win32
<triangle345> i will probably be able to use system but it is a lot slower and i was looking to do something more complex to eventually being able to do a createprocess
triangle345 has quit [Ping timeout: 264 seconds]
jemc_ has quit [Ping timeout: 252 seconds]
montanonic has joined #ponylang
allplayersdd has joined #ponylang
<allplayersdd> how much test coverage does ponylang have?
triangle345 has joined #ponylang
<triangle345> hey are any devs on right now to help answer a ffi question?
<allplayersdd> yes go ahead
<triangle345> im trying to do something liek this under windows:
<triangle345> @ShellExecute[U32](NULL, "open".cstring(), "cmd.exe".cstring(), "/C ipconfig > out.txt".cstring(), "".cstring(), U32(0))
<triangle345> but keep getting unresolved lnk reference errors
<triangle345> i use at the top: use "lib:shell32"
<triangle345> i also tried replacing the args with primitives i made, thats why you see the "NULL" in there
<triangle345> error LNK2019: unresolved external symbol ShellExecute referenced in function Main_Dispatch
<triangle345> thats the specific line - sorry it was unresolved symbol?
c355e3b has joined #ponylang
_andre has joined #ponylang
<allplayersdd> im not actually a dev but its better to just ask
<triangle345> i asked my question above yours
<triangle345> is it visible?
<CcxCZ> triangle345: It is. allplayersdd just joined after that.
<CcxCZ> I kinda wish I could help. But on the other hand, for my own sanity, I don't desire deep understanding of Win32 internals. :P
<triangle345> haha yea its a necessary evil :)
<triangle345> allplayersdd: just in case you missed it:
<triangle345> i'm trying to run ffi @ShellExecute[U32](NULL, "open".cstring(), "cmd.exe".cstring(), "/C ipconfig > out.txt".cstring(), "".cstring(), U32(0)) but keep getting unresolved symbol errors and i'm definitely useing the use "lib:shell32" line
<CcxCZ> Wasn't ShellExecute more of a COM object rather than simple library call? I forgot the details. I remember needing to use that COM thingy (from FoxPro, don't ask) to avoid nasty mess of winapi calls to have popen() equivalent.
<triangle345> yea but i get the same error on other functions such as CreateProcess
<allplayersdd> what symbol errors do you get?
<allplayersdd> should be googleable what .dlls you have to include
<triangle345> error LNK2019: unresolved external symbol ShellExecute referenced in function Main_Dispatch
<triangle345> msdn says shellexecute uses shell32.lib
<triangle345> i put the dll in the current path but that had no effect
<CcxCZ> There's some depend.exe or dependency.exe tool to introspect dynlinking and determine what is where.
<triangle345> but msdn says exactly where it is:
<triangle345> Library Shell32.lib DLL Shell32.dll (version 3.51 or later)
triangle345 has quit [Ping timeout: 264 seconds]
montanonic has quit [Ping timeout: 276 seconds]
Praetonus has joined #ponylang
jemc_ has joined #ponylang
allplayersdd has quit [Read error: Connection reset by peer]
amclain has joined #ponylang
dinfuehr_ has joined #ponylang
montanonic has joined #ponylang
Matthias247 has joined #ponylang
_andre has quit [Quit: leaving]
M-Ingo has joined #ponylang
TwoNotes has joined #ponylang
<M-Ingo> Hello, I just found ponylang and may check it out, so I just joined here to see what's happening.
<TwoNotes> Praetonus, so your fix to single store is in master now?
<Praetonus> TwoNotes: Yes. I think it should fix the problem. I'm also doing an audit of atomics in the codebase so it may help spot other potential problems
<jemc_> M-Ingo: welcome! let us know if you have any questions :)
jemc_ is now known as jemc
<TwoNotes> Ok, pulling it now, and I will test it on ARM
Matthias247 has quit [Read error: Connection reset by peer]
triangle345 has joined #ponylang
<triangle345> hey guys any devs on here.. i have an ffi issue for windows
<triangle345> trying to run @ShellExecute[U32](NULL, "open".cstring(), "cmd.exe".cstring(), "/C ipconfig > out.txt".cstring(), "".cstring(), U32(0))
<triangle345> and keep getting this error: error LNK2019: unresolved external symbol ShellExecute referenced in function Main_Dispatch
<doublec> I suspect ShellExecute is exported with a different name
<triangle345> however; i do have using "lib:shell32" at the top of my file
<triangle345> how do you know its exported under a different name?
<doublec> triangle345: can you try with more verbosity. eg. ponyc --verbose=3
<doublec> triangle345: that prints the actual commands as they are run
<triangle345> sure
<doublec> triangle345: also, can you run dumpbin /exports shell32.dll
<doublec> triangle345: and see the exports
<triangle345> cmd /C ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\link.exe" /DEBUG /NOLOGO /MACHINE:X64 /OUT:.\ponycod e.exe .\ponycode.obj /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0\ucrt\x64" /LIBPATH:"C:\Program Fi les (x86)\Windows Kits\10\Lib\10.0.14393.0\um\x64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\ amd64" /LIBPATH:"C:\ponyc\ponyc\bin" /LIBPATH:"C:\ponyc\ponyc\bin\..
<triangle345> looks like some of it got cut off
<doublec> can you pastebin it?
<triangle345> can you see that
<triangle345> wierd thing is it put shell32 in qoute
<triangle345> qoutes
<doublec> hmm, is there a shell32.lib anyway?
<triangle345> so if i mistype that like do "she32" it gives me a different error
<triangle345> so it must be finding it
<Praetonus> triangle345: To find the real symbol name, you can create a C program wich uses the function and look at the assembly code generated
<doublec> triangle345: try calling the function: ShellExecuteA
<doublec> triangle345: Windows has a A and W version of the functions IIRC
<doublec> (for ascii and wide strings)
<triangle345> ohh
<triangle345> that worked
<triangle345> thanks!
<triangle345> how did you find that name out?
<doublec> triangle345: where the table has "Unicode and ascii names"
<doublec> And I recall vaguely dealing with it when I used win32 years ago
<doublec> The win32 headers makes ShellExecute a C #define that goes to the A or W version depending on various things
<triangle345> ah i see
<jemc> ah, preprocessor macros as public API - the bane of FFI development
<CcxCZ> triangle345: That's why I suggested using introspection tool. :P
<jemc> its worst when the function or struct behind the macro isn't supposed to be a part of the public API, so you can't depend on it being stable >_<
<doublec> Or when it replaces some other usage that happens to clash with the macro name but would have been fine if it was just a function
<jemc> it's getting better, at least though - in the age of a billion languages many modern C libraries have chosen to make their APIs more friendly for FFI usage
<jemc> things like functions to look up the meaning of C constants, or lookup string error messages, etc
<Praetonus> Maybe we could expand ponyc to parse C headers with libClang or something, and make the C declarations available to FFI
<doublec> That'd be neat!
<triangle345> thanks for the help guys! btw, that is a good idea with the clang lookup
jemc has quit [Ping timeout: 244 seconds]