hxcs icon indicating copy to clipboard operation
hxcs copied to clipboard

How to define or pass dll "config" information for mac systems?

Open Justinfront opened this issue 9 years ago • 0 comments

On mac using many dll like the ones associated with GTK require the related dylib's used to be associated properly. Currently there is no documentation on how this should be done or if this is currently possible. It seems to be a general issue causing problems for mono developers working on mac, and more of a problem for haxe developers because the workflow is not standards so googling will not provide a solution that is easy to understand in a haxe context. eg:

http://stackoverflow.com/questions/13885454/mono-on-osx-couldnt-find-gtksharpglue-2-dll

with the haxe workflow as I said it's not so obvious what the best approach is, but the basic concept is that mono does not find or understand dylib's without a config.dll file next to the dll file.

http://www.mono-project.com/docs/advanced/pinvoke/dllmap/

For instance if we try to use c# on a mac to do gtk we would need an hxml files like the linux one found in this project:

https://github.com/cambiata/haxe-cs-gtk-cairo/blob/master/build-linux.hxml

so the hxml for a mac might look like

-cs bin-mac

-cp src

-main Main

-D net-ver=40

-D verbose

-net-lib Library/Frameworks/Mono.framework/Libraries/gac/atk-sharp/2.12.0.0__35e10195dab3c99f/atk-sharp.dll

-net-lib Library/Frameworks/Mono.framework/Libraries/gac/pango-sharp/2.12.0.0__35e10195dab3c99f/pango-sharp.dll

-net-lib/Library/Frameworks/Mono.framework/Libraries/gac/gdk-sharp/2.12.0.0__35e10195dab3c99f/gdk-sharp.dll

-net-lib Library/Frameworks/Mono.framework/Libraries/gac/gtk-sharp/2.12.0.0__35e10195dab3c99f/gtk-sharp.dll

-net-lib Library/Frameworks/Mono.framework/Libraries/gac/glib-sharp/2.12.0.0__35e10195dab3c99f/glib-sharp.dll

-net-lib Library/Frameworks/Mono.framework/Libraries/gac/gtk-dotnet/2.12.0.0__35e10195dab3c99f/gtk-dotnet.dll

-net-lib Library/Frameworks/Mono.framework/Libraries/gac/Mono.Cairo/4.0.0.0__0738eb9f132ed756/Mono.Cairo.dll

-cmd rm bin-mac/bin/atk-sharp.dll

-cmd rm bin-mac/bin/pango-sharp.dll

-cmd rm bin-mac/bin/gdk-sharp.dll

-cmd rm bin-mac/bin/gtk-sharp.dll

-cmd rm bin-mac/bin/glib-sharp.dll

-cmd rm bin-mac/bin/gtk-dotnet.dll

-cmd rm bin-mac/bin/Mono.Cairo.dll

-cmd cd bin-mac/bin/

-cmd mono Main.exe

But this fails at runtime because we also need to link the dylib files associated with some of these dll normally defined in xml next to the dll. like perhaps these:

dllmap os="osx" dll="libgtk-win32-2.0-0.dll" target="/Library/Frameworks/Mono.framework/Versions/2.10.9/lib/libgtk-quartz-2.0.0.dylib" dllmap os="osx" dll="glibsharpglue-2" target="/Library/Frameworks/Mono.framework/Versions/2.10.9/lib/libglibsharpglue-2.so" dllmap os="osx" dll="libgthread-2.0-0" target="/Library/Frameworks/Mono.framework/Versions/2.10.9/lib/libgthread-2.0.0.dylib" dllmap os="osx" dll="libgthread-2.0-0.dll" target="/Library/Frameworks/Mono.framework/Versions/2.10.9/lib/libgthread-2.0.0.dylib" dllmap os="osx" dll="libglib-2.0-0.dll" target="/Library/Frameworks/Mono.framework/Versions/2.10.9/lib/libglib-2.0.0.dylib" dllmap os="osx" dll="libgobject-2.0-0.dll" target="/Library/Frameworks/Mono.framework/Versions/2.10.9/lib/libgobject-2.0.0.dylib"

( had to remove xml wrappers as text was not showing )

So my question is could the hxcs haxelib automatically handle these config.dll files found next to the dll's or can you explain the best approach, I would not be so keen on adding global variables to the system to achieve this as they may not be transferable between platforms although that seems a solution mentioned but some clarity in respect of haxe would be useful if this is the approach ( perhaps what is required for the linked project of Jonas above ).

Sorry if doing this dylib stuff is considered easy, but I think it would be nice to add documentation or atleast have some git examples in the wild.

Many thanks Justin

Justinfront avatar Jun 23 '15 09:06 Justinfront