[Mono-dev] DllImport("__Internal") and libMonoPosixHelper static build

Rafael Teixeira monoman at gmail.com
Fri Apr 13 18:34:41 UTC 2012

AFAIK, the DLLImport binding depend on loading information of dynamic
libraries, if you want to call something statically linked in the runtime
you'll need to move to using internal calls, but that means an extensive
rewrite of the the affected libraries both managed and native as the
protocol doesn't include automatic marshaling of managed types, and correct
versioning is a must to avoid crashes on incompatible ABIs.

Another possibility is to change the dynamic libraries binding mechanism to
search for statically linked symbols, not sure how complex this would be.

The best alternative is to fix the loader and keep the .so files around.

Just my two cents,

Rafael "Monoman" Teixeira
"The most exciting phrase to hear in science, the one that heralds new
discoveries, is not 'Eureka!' (I found it!) but 'That's funny ...'"
Isaac Asimov
US science fiction novelist & scholar (1920 - 1992)

On Thu, Apr 12, 2012 at 4:43 AM, ralphbariz <ralph.bariz at gmail.com> wrote:

> Hi,
> I'm trying to compile a static one binary mono(Because the target system
> has
> an incompatible loader).
> First I got mono to build statically, but without libMonoPosixHelper in the
> archive. After a few tries, I got also this, changed all DllImport(MPH)
> calls in Mono.Posix.dll to DllImport("__Internal"), it still gives me a
> TypeInitializationexception when I try to access the stat symbol of the
> libMonoPosixHelper. With objdump I looked inside, the symbols of
> libMonoPosixHelper are all inside the archive, so what am I doing wrong?
> The script used to build: http://pastebin.com/t7dqdBYn
> Regards
> Ralph
> --
> View this message in context:
> http://mono.1490590.n4.nabble.com/DllImport-Internal-and-libMonoPosixHelper-static-build-tp4551182p4551182.html
> Sent from the Mono - Dev mailing list archive at Nabble.com.
> _______________________________________________
> 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/20120413/d7dd1b54/attachment.html>

More information about the Mono-devel-list mailing list