|
what C method?
the method to create the object?
that's not a .NET object.
I can already do all this mapping in C. There's no point in any of that.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
you do understand that paged memory allows you to do pointer ops directly to a file, i assume?
and that normally what you'd do is just create your data structures at that memory mapped address and then use them like normal classes and structure, which are automatically written to disk as they are accessed.
struct foo {
int bar;
};
foo* pfoo = VirtualAlloc(..., sizeof(foo));
pfoo->bar=1; printf("%d",pfoo->bar);
there is simply no way to do that in .NET
if you're saying there is show me how. Your method call technique does not enable this.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
lol yes there is. You didn't read anything I said.
As I said before. C# pointers are the same as C/C++. Look at the example below.
I literally just compiled and ran this on my computer with zero errors.
using System;
using System.Runtime.InteropServices;
using SIZE_T = System.IntPtr;
using DWORD = System.UInt32;
namespace TestNet
{
[StructLayout(LayoutKind.Sequential)]
struct Foo
{
public int bar;
}
static class Program
{
[DllImport("Kernel32.dll")]
private static unsafe extern void* VirtualAlloc(void* lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect);
private const DWORD MEM_COMMIT = 0x00001000;
private const DWORD PAGE_READWRITE = 0x04;
static unsafe void Main(string[] args)
{
Foo* pfoo = (Foo*)VirtualAlloc((void*)0, (SIZE_T)sizeof(Foo), MEM_COMMIT, PAGE_READWRITE);
pfoo->bar = 1;
Console.WriteLine(pfoo->bar.ToString());
}
}
}
Make a C# console app and paste that code in. WaLa!!
|
|
|
|
|
i'm going to try that. Assuming it works, I apologize for all the churn. You may have just taught my stubborn self something.
the example really helped, so thank you.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
np
|
|
|
|
|
Thanks for sticking with it and being nice and teaching us all something new.
#SupportHeForShe
Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson
You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun
|
|
|
|
|
Is Scrabble just the IKEA booklist?
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
[ I guess there's not going to be a Thought of the Day today ]
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
What's the Swedish for "that went clean over my head?"
Whenever you find yourself on the side of the majority, it is time to pause and reflect. - Mark Twain
|
|
|
|
|
build your own book using scrabble words.
ikea: some assembly required.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
sigh, everybody knocks IKEA furniture
... then it falls over
Message Signature
(Click to edit ->)
|
|
|
|
|
when we remodeled we gutted the kitchen and installed ikea cabinets. I have no complaints. In fact, the instructions were good, and they are fairly durable.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
honey the codewitch wrote: the instructions were good, and they are fairly durable.
Well I have always wanted durable instructions...
I, for one, like Roman Numerals.
|
|
|
|
|
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Of course!
Thank you, I'm clearly an Allen key short today!
Whenever you find yourself on the side of the majority, it is time to pause and reflect. - Mark Twain
|
|
|
|
|
No. You also need the NOUNSTIK glue, and the PAGESTIK bindery (extra cost).
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Can you, as a favour to us at CodeProject, and to all those who just want to come to the lounge to chat and enjoy a bit of company, give it a rest?
All you're doing is taking our time away from helping those who are trying to share their code, their articles, their time to answer questions on the forums and question boards.
If you're bored then please take it elsewhere. A little respect for what we're trying to do here, please.
cheers
Chris Maunder
|
|
|
|
|
am i posting here too much? I'm not bored, just wordy, but I will can it.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
There's being loquacious and there's being deliberately offensive. The difference is pretty easy to spot.
cheers
Chris Maunder
|
|
|
|
|
The message you closed, i honestly wasn't trying to be offensive, but i apologize. I'll be more careful.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
I didn't close anything. It may have been reported and closed by others.
cheers
Chris Maunder
|
|
|
|
|
ahw, honey! what did you say? i thought you were the sweet witch!??!
#SupportHeForShe
Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson
You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun
|
|
|
|
|
I posted a music video called "Lick the Witch" (not dirty like it sounds)
claimed it was my theme song, and dedicated it to sander so he'd know when i was approaching.
only i said "know when i was coming" and then OriginalGriff went and made it weird. =)
anyway, it seems to have been reported by a number of people here, considering it was removed.
I'm not the good witch, but i'm not exactly evil either, despite Sander's protestations.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
|
oh i thought it was closed. Curious. Oh well. =)
it's a fun video
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|