On Fri, 2010-09-10 at 09:45 +0200, Jovica Zaric wrote:
> Hi guys,
> 
> I'm wondering if poker-eval should still work with DllImport?
> 
> I was able to compile poker-eval and get dll file. I can see functions
> with nirsoft DLL Export Viewer.
> But when I run following code
> 
>       int card;
>       API.StdDeck_stringToCard(cardStr, out card);
> 
> I get "Attempted to read or write protected memory. This is often an
> indication that other memory is corrupt."
> 
> I'm using VS 2010 .NET 4 on Win 7 x64.
> 
> Is this something anybody came across before?
> 
> Thanks in advance.
> 
> Jovica

I get a segfault when executing poker-eval csharp test suite with
mono/nunit, after applying the following patch, I wonder if the issue is
related ?

Did you try to run the test suite on VS 2010 ?

pro...@unubore:~/Desktop/pokersource/poker-eval/csharp$ 
LD_LIBRARY_PATH=../lib/.libs make check
nunit-console PokerEval.Enum.dll
NUnit version 2.4.7
Copyright (C) 2002-2007 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.

Runtime Environment - 
   OS Version: Unix 2.6.35.20635
  CLR Version: 2.0.50727.1433 ( Mono 2.4.4 )

.................................................Holdem Hi: 0 enumerated boards
cards     win   %win      lose  %lose       tie   %tie        EV
.Holdem Hi: 1 sampled board containing Ks Kc Kh
cards     win   %win      lose  %lose       tie   %tie        EV
As Ac       1 100.00         0   0.00         0   0.00     1.000
Qs Qc       0   0.00         1 100.00         0   0.00     0.000
Histogram of relative hand ranks:
Stacktrace:


Native stacktrace:

        /usr/bin/cli() [0x47b77f]
        /usr/bin/cli() [0x4aef3f]
        /lib/libpthread.so.0(+0xf8f0) [0x2b85471228f0]
        ../lib/.libs/libpoker-eval.so(+0x428f) [0x2aaab0a1728f]
        ../lib/.libs/libpoker-eval.so(enumResultPrint+0x27a) [0x2aaab0a17aaa]
        [0x41a2f90a]

Debug info from gdb:

[Thread debugging using libthread_db enabled]
[New Thread 0x2aaab0a0e710 (LWP 10296)]
[New Thread 0x2aaab0809710 (LWP 10295)]
[New Thread 0x2aaab04bc710 (LWP 10294)]
[New Thread 0x2aaab02b7710 (LWP 10293)]
[New Thread 0x2aaaabc10710 (LWP 10292)]
[New Thread 0x2aaaab9af710 (LWP 10291)]
0x00002b854711e85c in pthread_cond_wait@@GLIBC_2.3.2 () from 
/lib/libpthread.so.0
  7 Thread 0x2aaaab9af710 (LWP 10291)  0x00002b854712211d in nanosleep () from 
/lib/libpthread.so.0
  6 Thread 0x2aaaabc10710 (LWP 10292)  0x00002b8547120b50 in sem_wait () from 
/lib/libpthread.so.0
  5 Thread 0x2aaab02b7710 (LWP 10293)  0x00002b854711ebc9 in 
pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
  4 Thread 0x2aaab04bc710 (LWP 10294)  0x00002b854711ebc9 in 
pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
  3 Thread 0x2aaab0809710 (LWP 10295)  0x00002b854711e85c in 
pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
  2 Thread 0x2aaab0a0e710 (LWP 10296)  0x00002b854712193d in read () from 
/lib/libpthread.so.0
* 1 Thread 0x2b8547b66620 (LWP 10290)  0x00002b854711e85c in 
pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0

Thread 7 (Thread 0x2aaaab9af710 (LWP 10291)):
#0  0x00002b854712211d in nanosleep () from /lib/libpthread.so.0
#1  0x0000000000556342 in ?? ()
#2  0x00002b85471199ca in start_thread () from /lib/libpthread.so.0
#3  0x00002b854769a6fd in clone () from /lib/libc.so.6
#4  0x0000000000000000 in ?? ()

Thread 6 (Thread 0x2aaaabc10710 (LWP 10292)):
#0  0x00002b8547120b50 in sem_wait () from /lib/libpthread.so.0
#1  0x00000000004e4aaa in ?? ()
#2  0x0000000000505035 in ?? ()
#3  0x0000000000570073 in ?? ()
#4  0x000000000058de21 in ?? ()
#5  0x00002b85471199ca in start_thread () from /lib/libpthread.so.0
#6  0x00002b854769a6fd in clone () from /lib/libc.so.6
#7  0x0000000000000000 in ?? ()

Thread 5 (Thread 0x2aaab02b7710 (LWP 10293)):
#0  0x00002b854711ebc9 in pthread_cond_timedwait@@GLIBC_2.3.2 () from 
/lib/libpthread.so.0
#1  0x000000000055b45d in ?? ()
#2  0x00000000005736d6 in ?? ()
#3  0x00000000005025cb in ?? ()
#4  0x0000000041bd574e in ?? ()
#5  0x000000000111a590 in ?? ()
#6  0x00002aaaabf8af28 in ?? ()
#7  0x0000000000001192 in ?? ()
#8  0x0000000041bd5604 in ?? ()
#9  0x0000000000000000 in ?? ()

Thread 4 (Thread 0x2aaab04bc710 (LWP 10294)):
#0  0x00002b854711ebc9 in pthread_cond_timedwait@@GLIBC_2.3.2 () from 
/lib/libpthread.so.0
#1  0x000000000055b45d in ?? ()
#2  0x00000000005736d6 in ?? ()
#3  0x00000000005025cb in ?? ()
#4  0x0000000041bdfb9e in ?? ()
#5  0x00000000011eb7a0 in ?? ()
#6  0x00002aaaabf8a578 in ?? ()
#7  0x0000000000001193 in ?? ()
#8  0x0000000041bdfa54 in ?? ()
#9  0x0000000000000000 in ?? ()

Thread 3 (Thread 0x2aaab0809710 (LWP 10295)):
#0  0x00002b854711e85c in pthread_cond_wait@@GLIBC_2.3.2 () from 
/lib/libpthread.so.0
#1  0x000000000055b51c in ?? ()
#2  0x0000000000573885 in ?? ()
#3  0x00000000005014b3 in ?? ()
#4  0x0000000040e97338 in ?? ()
#5  0x000000000105e5b0 in ?? ()
#6  0x00002aaab006c618 in ?? ()
#7  0x00002aaab0808b60 in ?? ()
#8  0x0000000040e96e90 in ?? ()
#9  0x00002aaaabff15e0 in ?? ()
#10 0x00002aaab0808cc0 in ?? ()
#11 0x00002aaab0808bd0 in ?? ()
#12 0x0000000000000000 in ?? ()

Thread 2 (Thread 0x2aaab0a0e710 (LWP 10296)):
#0  0x00002b854712193d in read () from /lib/libpthread.so.0
#1  0x000000000047b8f4 in ?? ()
#2  0x00000000004aef3f in ?? ()
#3  <signal handler called>
#4  0x00002aaab0a1728f in enumResultPrintOrdering (result=0x2aaab0a0a9f0, 
terse=0) at enumerate.c:783
#5  0x00002aaab0a17aaa in enumResultPrint (result=0x2aaab0a0a9f0, 
pockets=0x2aaab04f7ff0, board=...) at enumerate.c:931
#6  0x0000000041a2f90a in ?? ()
#7  0x00002aaab0a0d220 in ?? ()
#8  0x00002aaab0a0a720 in ?? ()
#9  0x00002aaab0a0d0a0 in ?? ()
#10 0x00002aaab04f7fc0 in ?? ()
#11 0x00002aaaac191540 in ?? ()
#12 0x00002aaab0a0d0a0 in ?? ()
#13 0x00002aaab0a0a910 in ?? ()
#14 0x00002aaab04f6fb0 in ?? ()
#15 0x0000000000000000 in ?? ()

Thread 1 (Thread 0x2b8547b66620 (LWP 10290)):
#0  0x00002b854711e85c in pthread_cond_wait@@GLIBC_2.3.2 () from 
/lib/libpthread.so.0
#1  0x000000000055b51c in ?? ()
#2  0x0000000000573885 in ?? ()
#3  0x0000000000503901 in ?? ()
#4  0x0000000040e9766b in ?? ()
#5  0x00007fff18a9e808 in ?? ()
#6  0x00002aaaac1d2ee8 in ?? ()
#7  0x00002aaab0074738 in ?? ()
#8  0x00002aaab00b47f8 in ?? ()
#9  0x00002aaab00b47f8 in ?? ()
#10 0x00007fff18a9e740 in ?? ()
#11 0x00007fff18a9e600 in ?? ()
#12 0x00002aaaac1d2ee8 in ?? ()
#13 0x00002aaab0074738 in ?? ()
#14 0x00002aaab00b47f8 in ?? ()
#15 0x00002aaaabff1468 in ?? ()
#16 0x0000000040e97604 in ?? ()
#17 0x00002aaab0033980 in ?? ()
#18 0x0000000040e974f0 in ?? ()
#19 0x00002aaab0074738 in ?? ()
#20 0x0000000040e973d4 in ?? ()
#21 0x00002aaab0074738 in ?? ()
#22 0x0000000040e97384 in ?? ()
#23 0x00002aaaabf87000 in ?? ()
#24 0x0000000040e96b6c in ?? ()
#25 0x00002aaab006b8a0 in ?? ()
#26 0x00002aaab00b47f8 in ?? ()
#27 0x00002aaab04f6990 in ?? ()
#28 0x0000000040e96b27 in ?? ()
#29 0x00002aaab006b8a0 in ?? ()
#30 0x00002aaab04dba00 in ?? ()
#31 0x00002aaab04f6990 in ?? ()
#32 0x0000000040e934a0 in ?? ()
#33 0x00002aaab00b47f8 in ?? ()
#34 0x00002aaab00b47e0 in ?? ()
#35 0x00002aaab0521630 in ?? ()
#36 0x00002aaab04f6990 in ?? ()
#37 0x00002aaab04dba00 in ?? ()
#38 0x00002aaab04dba00 in ?? ()
#39 0x00002aaab0521630 in ?? ()
#40 0x00002aaaac1b0410 in ?? ()
#41 0x0000000040e933e0 in ?? ()
#42 0xfffffffffffffffe in ?? ()
#43 0x00002aaab04f6990 in ?? ()
#44 0x00002aaab05219c0 in ?? ()
#45 0x00007fff18a9e860 in ?? ()
#46 0x0000000040e8f845 in ?? ()
#47 0x00007fff18a9e8d8 in ?? ()
#48 0x00007fff18a9e8c8 in ?? ()
#49 0x00002aaab0035138 in ?? ()
#50 0x00002aaab04f6990 in ?? ()
#51 0x00002aaab04dba00 in ?? ()
#52 0x00002aaab006b8a0 in ?? ()
#53 0x0000000000000000 in ?? ()

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

make: *** [check] Aborted
pro...@unubore:~/Desktop/pokersource/poker-eval/csharp$ svn diff
Index: EnumResult.cs
===================================================================
--- EnumResult.cs       (revision 6569)
+++ EnumResult.cs       (working copy)
@@ -29,7 +29,7 @@
 
 namespace PokerEval
 {
-  public struct EnumResult
+  public unsafe struct EnumResult
   {
     int game;
     int sampleType;
Index: Makefile
===================================================================
--- Makefile    (revision 6569)
+++ Makefile    (working copy)
@@ -35,10 +35,10 @@
 all: $(NAME)
 
 $(NAME): $(SRCS)
-       mcs $(SRCS) -target:library -out:$(NAME) -pkg:nunit
+       gmcs $(SRCS) -unsafe+ -target:library -out:$(NAME) -pkg:nunit
 
 clean:
-       rm -f $(NAME) *~
+       rm -fR $(NAME) *~ '%temp%'
 
 check: $(NAME)
-       nunit-console $(NAME)
\ No newline at end of file
+       nunit-console $(NAME)


-- 
Johan Euphrosine (proppy) <[email protected]>
Development and services around Free Software
http://www.aminche.com/

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Pokersource-users mailing list
[email protected]
https://mail.gna.org/listinfo/pokersource-users

Reply via email to