[Mono-dev] Mixed Mode Assemblies

Pablo Ruiz pablo.ruiz at gmail.com
Sat Jul 9 08:13:42 EDT 2011


Another 'problem' with this approach is size. Due to the fact that the
native component I'm using it's quite big (chrome + qt are quite huge), the
final assembly weights a few MBs.. :(

On Sat, Jul 9, 2011 at 2:10 PM, Pablo Ruiz <pablo.ruiz at gmail.com> wrote:

> Well, I managed to do exctly this (extracting embedded .dll/.so & it's
> dependencies on Win32/Win64/Linux32/Linux64) on WkHtmlToXSharp (
> https://github.com/pruiz/WkHtmlToXSharp).
>
> And I got fine results. It has some limitations (like being able to write
> on working dir, etc.) but it makes deployment alot easier. I even check if
> the file exists before extracting to allow onfield upgrade of native
> assemblies..
>
>
> On Sat, Jul 9, 2011 at 2:05 PM, Robert Jordan <robertj at gmx.net> wrote:
>
>> On 09.07.2011 12:20, Quandary wrote:
>> > It's true that p/Invoke + InterOp services do not form a complete
>> solution.
>> > However, creating a interface in managed code across platforms isn't
>> > very difficult.
>> >
>> > All you need to do is to pack a x86&x64&ARM&PPC Linux&Windows&Mac
>> > version of the native dll into the .NET dll's ressources, then stream
>> > the respective assembly out on the calling of the constructor, and
>> > create an abstract class, where you create an instance for the
>> > respective platform (for example because of structs, where on x64, there
>> > are different sizes of long + int on Windows&  Linux/UNIX), which you
>> > can then invoke as an interface.
>>
>> Extracting and loading native libraries at run-time won't work
>> correctly on sane systems, unless you somehow manage to (1)
>> extract them into a path already configured as a library path,
>> (2) using absolute paths in DllImport attributes, (3) generating
>> DllImport code at run-time or (4) loading the libs and their
>> exports w/out DllImport's help (dlopen, LoadLibrary etc.).
>>
>> That's why nobody is using such an approach in real world,
>> at least not under Unix. Using <dllmap> or a starter shell
>> script that sets the LD path is by far less complex (a
>> matter of minutes to develop).
>>
>> Robert
>>
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20110709/c8733af9/attachment.html 


More information about the Mono-devel-list mailing list