IRC Networks
Irc Logs Stats
Start date: 2007-09-27 02:48:27
Last update: 2008-10-24 20:19:38
Channels: 41
Logged Lines: 6230436
Size: 1825.68 MB
Powered by
Channel Info
Network: freenodeChannel: #csharp |
Search in www.irclog.org
Log from #csharp at freenode 2006-07-31
[15:31]<lcs>hm
[15:31]<lcs>but i think that coversion is easy task
[15:33]<svlnvnz>u are right
[15:36]<lcs>you can always make 30 'versions' of the [dllimported] functions :)
[15:36]<lcs>i think that it would work
[15:36]<svlnvnz>can i also need to ask if someone know of a good c# library for AI networks (with backpropagation etc)
[15:37]<svlnvnz>pks: mmm it's not a good pratice :)
[15:37]<lcs>you can make a reflection
[15:37]<lcs>that will dynamicaly do the stuff
[15:37]<lcs>that is even worse from the speed point of view
[15:37]<svlnvnz>anyway for some of the functions is ok for what i need
[15:37]<lcs>;-)
[15:38]<svlnvnz>mmm
[15:38]<svlnvnz>reflecting on what?
[15:39]<lcs>i dont know anything about reflection, except that it allows program to modify itseld
[15:40]<lcs>or am i wrong? :)
[15:41]<pzynsv-jp-psy>hmmm
[15:41]<svlnvnz>like: i call a managed func that cycle on the managed arguments and modify the stub that call unmanaged code to suit the managed parameters?
[15:42]<lcs>mhm
[15:42]<lcs>yes, this way
[15:42]<lcs>generate code that will import function with proper number of arguments (only if such function hasnt been imported yet)
[15:42]<svlnvnz>mmm trying
[15:42]<lcs>so it wont be as slow as it looks
[15:42]<lcs>:)
[15:43]<lcs>food time
[15:43]<svlnvnz>:)
[15:44]<y-gz>stpeter: paste me C signature for a function you are trying to P/Invoke
[15:59]<svlnvnz>int func(uint,...) (the ellipsis is intended to be a list of uint)
[15:59]<svlnvnz>this is one
[15:59]<e-2jfr>I have a string like "sdfsdf 3: 34,15,60" Whats the easiest way to extract and remove the part of the sentence before the first comma? (In this case that would be Funky_People--Higher_Love-(BDA012)-Vinyl-1993-dh)
[15:59]<e-2jfr>woops
[15:59]<e-2jfr>last par should be "sdfsdf 3: 34" ofcourse
[16:00]<lcs>E-bola: Regex
[16:00]<e-2jfr>brrr im very rusty in regex
[16:01]<e-2jfr>i was gonna use a split and a foreach with an if sentence to do something on the first run
[16:01]<cjmgrug>E-bola: get Expresso
[16:01]<lcs>replace(), pattern '(.*,)'
[16:01]<e-2jfr>and then do a string.length on the stuff i extracted
[16:01]<svlnvnz>i-nZ: the call is like: int ret = func(3,200,20,10) (3 args in the ellipsis because the first arg is 3)
[16:01]<e-2jfr>and then use substring to remove it
[16:01]<e-2jfr>but gotta be an easier way?
[16:01]<y-gz>stpeter: isn't param[] what you need ?
[16:01]<y-gz>stpeter: I mean what is the problem you are experiencing?
[16:02]<e-2jfr>pks: i dont know pattern() is that in context of regexp?
[16:03]<svlnvnz>i-nZ: the function always return an error
[16:03]<svlnvnz>param[] is a pointer
[16:03]<lcs>E-bola: no, pattern is one of the arguments for replace function :)
[16:03]<e-2jfr>ohh cool reading about it now
[16:03]<lcs>E-bola: anyway, you can do indexof, then substr
[16:03]<lcs>if you realy do not like regexps
[16:04]<e-2jfr>i dont :)
[16:04]<svlnvnz>i-nZ: the ... means any additiona argumet passed is copied on the stack
[16:04]<svlnvnz>i-nZ. as printf
[16:04]<cjmgrug>or you could download Expresso to take care of your regexps
[16:04]<y-gz>?
[16:05]<y-gz>yes you want to marshall to a va_list
[16:05]<e-2jfr>reg exp. always confuse me a bit cuz they are so cryptic, and the syntax varies from language to language
[16:05]<lcs>CodeRun: i think that its better to learn them
[16:05]<lcs>CodeRun: at least he will know the power of the tool he is dealing with
[16:05]<svlnvnz>i-nZ: yes
[16:05]<cjmgrug>its also better to manage your own memory.. rather than rely on managed<language>
[16:06]<txnjzd>cna I cast SomeClass<foo> to SomeClass<object> ?
[16:06]<y-gz>stpeter: I think your best bet is to dynamically generate the method signature and call it
[16:07]<cjmgrug>pks: i'm not saying ignore regexps.. i'm just saying that once you know what regex can do.. and some basic examples, then you can use a tool like expresso to keep you worried about your main problem rather than waste time on solving regex-related problems
[16:07]<y-gz>stpeter: va_lists etc are too specific to be supported anyway
[16:07]<y-gz>i think so at least
[16:08]<lcs>hehe, so as i said
[16:08]<svlnvnz>i think is strange that aren't supported: int func(uint,[MarshalAs(UnmanagedType.ByValArray)]params uint[]) express the situation very well i think
[16:08]<lcs>hm
[16:08]<lcs>true, it will
[16:09]<lcs>btw, are you able to put something longer than 4 bytes on the stack?
[16:09]<txnjzd>why wouldn't you be?
[16:09]<e-2jfr>I ended up with: s_l.Substring(0,s_l.IndexOf(","));
[16:10]<svlnvnz>pks: sure always :)
[16:10]<lcs>i dont know if its possible to pass array as an argument
[16:10]<e-2jfr>testing to see if i need to add or subtract 1 to the length
[16:10]<y-gz>btw stpeter
[16:10]<svlnvnz>is not supported but is possible
[16:10]<lcs>so you cannot
[16:10]<svlnvnz>in C u can also pass structs
[16:10]<lcs>that what i was asking
[16:10]<lcs>yap, you can pass structos, true
[16:10]<y-gz>stpeter: are you sure that params uint[] is supposed to be the equivalent of "..." in C
[16:10]<y-gz>so my logic is taht it should work
[16:11]<y-gz>dunno
[16:11]<y-gz>food time
[16:11]<lcs>so, create array, fill it with 'variable data', then pass it as an argument to the function
[16:11]<lcs>if you fill it correctly, c function should see it at variable arguments
[16:11]<svlnvnz>i think params uint[] means the pointer to the array but with some special attribute like Byvalarray should be it could be interpreted as put the array on the stack
[16:12]<svlnvnz>we wait for 2.1
[16:12]<lcs>just make sure that its contents will be placed on the stack, not it just its pointer
[16:12]<svlnvnz>like the [Unmanagedfunction.cdecl]
[16:13]<svlnvnz>i'm sure only the pointer is placed :(
[16:14]<lcs>isnt there a way to pass raw data? (i am not in front of the msdev)
[16:15]<svlnvnz>not byval
[16:15]<lcs>LAME
[16:15]<svlnvnz>true
[16:15]<lcs>so you have to implement that reflection
[16:15]<lcs>its not hard as you might think
[16:16]<svlnvnz>k, i'll try







