|
Noone can help you. You have to come up with a project idea that suits your skill level and is of interest to you.
Noone is going to do this project with you "50:50". This is YOU work assignment for YOUR class to demonstrate that YOU have learn the skills necessary to pass it.
|
|
|
|
|
Harsh, but true. In college I also had to do such an assignment together with three young ladies who unfortunately did not even know where to begin. In the end I wound up doing practically everything myself. I even managed to coach them through the discussion of the rsults with the professor, who obviously knew what was going on and simply played along. So we all got a passing grade, but I was the only one who also learned a little.
|
|
|
|
|
PreProc wrote: but I was the only one who also learned a little.
That is why we always advice people to at least try themselves....
|
|
|
|
|
He means he wants the project idea to be 50% easy and 50% challenging.
I agree, this is a dumb question and I don't get why so many people ask it.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
hi. Dunno how to properly name the question, but here it goes.
I got my lib (dll) exporting function which returns 2 unsigned long values:
1 is a single number and
2 is table which contains a lot of numbers. Basically it looks like this:
DWORD MyFunc(PULONG table, PULONG nr);
then call it:
ulong table[256];
ulong nr;
MyFunc(&table, &nr);
My dll is written in win32 api. Next i got C# app which have to access to this function.
And here i dont know to do it. Any suggestions?
code like:
Uint32[] table= new Uint32[256];
Uint32 nr = new Uint32();
MyFunc(out table, out nr);
crashes C# app.
|
|
|
|
|
csrss wrote: crashes C# app.
You cannot call a C/C++ Win32 function directly from C# in this way. You need to use the P/Invoke[^] mechanism.
|
|
|
|
|
Yes, i am using pinvke, i am loading my dll like this:
[DllImport("C:\\Users\\Administrator\\Desktop\\TinyDLL\\TinyDLL.dll", CharSet = CharSet.Auto)]
public static extern int function(
ref int[] table,
ref ulong nr
);
I am doing everything like it should be done. I know how to use win32 functions and pure native API functions from C# application. But i got no idea how this could be translated to C#:
ULONG something[256];
GetThisSomething(&something);
while "something" will contain tables of integers 
|
|
|
|
|
csrss wrote: ULONG something[256];
GetThisSomething(&something);
while "something" will contain tables of integers
I think you need something like:
int[] intArray = new int[256];
ulong ulNumber = 0;
GetThisSomething(ref intArray, ref ulNumber);
|
|
|
|
|
That is exactly what i am doing. And unfortunately it does not returning Table. It returns single number just fine but fails with Table 
|
|
|
|
|
Hi,
you can't use out or ref for this.
you need one of two techniques that ensure the arrays don't get moved around by the GC:
1.
The fixed keyword (C# only): it requires the unsafe keyword, and the "allow unsafe code" compiler switch; it fixes the object, and allows you to get its pointer. Here is a C# example:
unsafe public int ArrayFixed() {
int dim=1000;
int[] numbers=new int[dim];
...
int sum;
fixed (int* pNumbers=&numbers[0]) {
sum=SumArray(pNumbers, dim);
}
return sum;
}
[DllImport("native.dll")]
unsafe public static extern int SumArray(int* pNumbers, int count);
2.
The GCHandle class: it does not require any "unsafe" stuff; one needs to pin the object, get the pointer, and when done to unpin the object; here is a C# example:
public int ArrayHandle() {
int dim=10000;
int[] numbers=new int[dim];
...
GCHandle handle=GCHandle.Alloc(numbers, GCHandleType.Pinned);
int sum=SumArray(handle.AddrOfPinnedObject(), dim);
handle.Free();
return sum;
}
[DllImport("nativeC.dll")]
public static extern int SumArray(IntPtr pNumbers, int count);
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Luc Pattyn wrote: you need one of two techniques that ensure the arrays don't get moved around by the GC:
I should have remembered that from your article 
|
|
|
|
|
Right.
I'm still working on the subject; seems like it may grow into a series of 3 or more articles.
And it is getting more and more difficult to introduce all of it in a logical order as it all is strongly interconnected.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Luc, thanks very much, i will try this out
Edit: Now i got "unable to load dll, access to invalid memory location" ;/
This c# is killing me, i cannot even export simple HelloWorld function which return messagebox...
Going to switch back to gtk gui development, thanks anyway for your help guys.
modified on Sunday, October 25, 2009 9:04 PM
|
|
|
|
|
Hello,
this is my first post here, up to now I have only been reading. My question arose from an argument about my habit to write lines like
if( SomeBooleanvariable == true)
{
}
instead of
if( SomeBooleanvariable)
{
}
Granted, it's a bit verbose, but I did not think it would cause the compiler to generate slightly inefficient code. Looking at the disassembly settled the arguement. It generated the same code in both cases.
When looking at the disassembly I noticed something else. The compiler had inserted some apparently needless NOP instructions. What are they good for? This was taken from the release build:
if (bValue == true)
00000000 push ebp
00000001 mov ebp,esp
00000003 push ebx
00000004 sub esp,8
00000007 mov dword ptr [ebp-0Ch],ecx
0000000a mov dword ptr [ebp-8],edx
0000000d cmp dword ptr ds:[01BC150Ch],0
00000014 je 0000001B
00000016 call 685A9061
0000001b movzx eax,byte ptr [ebp-8]
0000001f test eax,eax
00000021 je 0000003E
{
m_lFlags = m_lFlags | (long)Flags;
00000023 mov eax,dword ptr [ebp-0Ch]
00000026 mov edx,dword ptr [eax+8]
00000029 mov eax,dword ptr [eax+4]
0000002c or eax,dword ptr [ebp+8]
0000002f or edx,dword ptr [ebp+0Ch]
00000032 mov ecx,dword ptr [ebp-0Ch]
00000035 mov dword ptr [ecx+4],eax
00000038 mov dword ptr [ecx+8],edx
0000003b nop
0000003c jmp 0000005D
}
else
{
m_lFlags = m_lFlags & ~(long)Flags;
0000003e mov eax,dword ptr [ebp+8]
00000041 mov edx,dword ptr [ebp+0Ch]
00000044 not eax
00000046 not edx
00000048 mov ebx,dword ptr [ebp-0Ch]
0000004b and eax,dword ptr [ebx+4]
0000004e and edx,dword ptr [ebx+8]
00000051 mov ecx,dword ptr [ebp-0Ch]
00000054 mov dword ptr [ecx+4],eax
00000057 mov dword ptr [ecx+8],edx
}
It has been a while since I really did some assembly on an x86 CPU and I see no immediate use for the NOP at address 0000003b. In the debug build there were more of them, but this one did not disappear in the release build.
|
|
|
|
|
The only thing I can think of is that it is for some sort of Word Boundary alignment thingy but I'm probably wrong.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Thanks, I thougt of something like this as well, but from the good old days I don't remember any such thing on a x86. Perhaps it's more like getting a pipeline penalty or some other disadvantage when the next instruction is on an odd address. It's just strange that the debug code had several more NOPs, even two in a row at one place.
|
|
|
|
|
PreProc wrote: It's just strange that the debug code had several more NOPs, even two in a row at one place.
I think the compiler adds all sorts of extras in DEBUG code in order to make it easier to stop and single step the code.
|
|
|
|
|
|
Thanks, at least some answers, along with many new questions.
I guess the times when you had full control over the actual code are long over. It's just that I don't like being less able to predict what the compiler will generate. Even in the good old times it was never a good idea to trust a computer.
|
|
|
|
|
PreProc wrote: Perhaps it's more like getting a pipeline penalty or some other disadvantage when the next instruction is on an odd address.
There is a penalty when a bitness-changing prefix (edit: just to be clear, a 66 or a 67) is split from an instruction where the ModR/M byte determines whether the length of the instruction is affected by the prefix, by a 16byte boundary
(and there are many other penalties but that's the only penalty I can think of that combines regular instructions and addresses) Last modified: 2hrs 24mins after originally posted --
|
|
|
|
|
"Pay no attention to that man behind the curtain."
|
|
|
|
|
Hi.
I created one custom control which derives from Control class, and I noticed that my control doesn't have location property. How can I add that property? So, when I change that property, control will move to knew location. Problem is I don't know how to get a location of a control in parent control from parent control...
|
|
|
|
|
Hmm, about what kind of control are we talking here? Windows Forms or ASP.Net? Or in other words: Does your control inherit from System.Web.UI.Control or from System.Windows.Forms.Control? In case of an ASP.Net control this would actually not be much of a surprise.
|
|
|
|
|
Hello guys,
I am developing a small application for a small shop and this application requires a small database to store the information. Now I thought that I could work with an mdf file as I think there is no need to install databases like mysql or sqlserver 2005, SLQEXPRESS would meet all the needs. Now my questions is what security measures must I take to make sure that the data isn't compromised. Should I store the mdf file somewhere special when the application is installing? Should the connection string be stored in some special way? And does .mdf files allow you to create users like in SQLServer 2005 (Stupid question I think but asking anyway hehe)
Thank you guys for your help in advance.
Regards,
Christian Pace
few
|
|
|
|
|
Hi All ...
I Have A Problem In Crystal Report
It's Apper blank Page betwwen 2 page
How I Can Solve This Problem ??
thanks
Thaer
|
|
|
|