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

2014-01-10 Thread mobin.seven
Robert Jordan wrote
> Your custom loader is supposed to support dlopen(NULL) and
> your linker must be able to export public symbols.
> See ld's --export-dynamic option.

Thanks Robert
In my case loader is not custom and supports dlopen(NULL) and I'm using
mkbundle.



--
View this message in context: 
http://mono.1490590.n4.nabble.com/DllImport-Internal-and-libMonoPosixHelper-static-build-tp4551182p4661661.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


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

2014-01-03 Thread Robert Jordan

On 31.12.2013 10:34, mobin.seven wrote:

Same here! Did you solve it?

ralphbariz 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?


Your custom loader is supposed to support dlopen(NULL) and
your linker must be able to export public symbols.
See ld's --export-dynamic option.


Robert


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


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

2014-01-03 Thread ralphbariz
Sadly no
Am 31.12.2013 11:37 schrieb "mobin.seven [via Mono]" <
ml-node+s1490590n4661646...@n4.nabble.com>:

> Same here! Did you solve it?
>
> ralphbariz 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?
>
>
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://mono.1490590.n4.nabble.com/DllImport-Internal-and-libMonoPosixHelper-static-build-tp4551182p4661646.html
>  To unsubscribe from DllImport("__Internal") and libMonoPosixHelper static
> build, click 
> here
> .
> NAML
>




--
View this message in context: 
http://mono.1490590.n4.nabble.com/DllImport-Internal-and-libMonoPosixHelper-static-build-tp4551182p4661647.html
Sent from the Mono - Dev mailing list archive at Nabble.com.___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


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

2014-01-03 Thread mobin.seven
Same here! Did you solve it?

ralphbariz 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?





--
View this message in context: 
http://mono.1490590.n4.nabble.com/DllImport-Internal-and-libMonoPosixHelper-static-build-tp4551182p4661646.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


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

2012-04-16 Thread Jonathan Pryor
On Apr 12, 2012, at 3:43 AM, ralphbariz wrote:
> I'm trying to compile a static one binary mono(Because the target system has 
> an incompatible loader).

What platform is this? What kind of loader does your target system have? Does 
it have any shared library loader?

> After a few tries, I got also this, changed all DllImport(MPH) calls in 
> Mono.Posix.dll to DllImport("__Internal"),

DllImport("__Internal") requires that the target platform (1) support 
dlopen(NULL, mode) to open the main executable, and (2) that dlsym() be able to 
find symbols within the main executable.

Note that (1) is not true for Windows, so [DllImport("__Internal")] will not 
work on Windows (iirc).

> it still gives me a TypeInitializationexception when I try to access the stat 
> symbol of the libMonoPosixHelper.

That's odd; Syscall.stat() P/Invokes Mono_Posix_Syscall_stat(), not stat():


https://github.com/mono/mono/blob/master/mcs/class/Mono.Posix/Mono.Unix.Native/Syscall.cs#L2851

Mono_Posix_Syscall_stat(), meanwhile, is just a simple wrapper around stat(2):

https://github.com/mono/mono/blob/master/support/sys-stat.c#L25

If your program is dying because Mono_Posix_Syscall_stat() can't be found, then 
the problem is probably that dlopen(NULL, mode) is not supported on your 
platform. If stat() can't be found, then (1) your platform doesn't provide 
stat(2), or (2) (somehow) your program is being improperly linked and stat() 
isn't being found.

 - Jon

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


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

2012-04-13 Thread Rafael Teixeira
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  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@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


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

2012-04-12 Thread ralphbariz
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@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list