#pragma managed/unmanaged
-
I discovered that you cannot use
#pragma unmanaged
for a member function of a managed class, even though the member function uses only unmanaged calls. Thus I have concluded that you can use#pragma unmanaged
only for unmanaged global functions or for unmanaged classes. But then, what's the bloody point, since unmanaged code will get compiled to native code anyway! :confused: Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
-
I discovered that you cannot use
#pragma unmanaged
for a member function of a managed class, even though the member function uses only unmanaged calls. Thus I have concluded that you can use#pragma unmanaged
only for unmanaged global functions or for unmanaged classes. But then, what's the bloody point, since unmanaged code will get compiled to native code anyway! :confused: Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
Thats the whole point, you can call the x86 code from managed code :)
#pragma managed
public __gc class MyClass
{
// other garbagevoid DoLotsOfUnmanagedThings()
{
unmanagedCall();
}
};#pragma unmanaged
void unmanagedCall()
{
// 100% unmanaged code goes here
}James Simplicity Rules!
-
Thats the whole point, you can call the x86 code from managed code :)
#pragma managed
public __gc class MyClass
{
// other garbagevoid DoLotsOfUnmanagedThings()
{
unmanagedCall();
}
};#pragma unmanaged
void unmanagedCall()
{
// 100% unmanaged code goes here
}James Simplicity Rules!
Well, when it sees a fuilly unmanaged function, why doesn't it auto-apply #pragma unmanaged to that block? Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
-
Well, when it sees a fuilly unmanaged function, why doesn't it auto-apply #pragma unmanaged to that block? Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
-
Well, when it sees a fuilly unmanaged function, why doesn't it auto-apply #pragma unmanaged to that block? Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
Nish [BusterBoy] wrote: Well, when it sees a fuilly unmanaged function, why doesn't it auto-apply #pragma unmanaged to that block? 1. Managed Code - Code that compiles into IL (atleast in the first version of CLR in the next version it would be possible to have IL unmanaged functions) 2. Unmanaged Code - Code that compiles into native processor's instructions So you see there is nothing called an unmanaged function before anything gets compiled. It is perfectly legal to have global functions in managed code. ILASM can create and use it( may be VB.NET).
-
Nish [BusterBoy] wrote: Well, when it sees a fuilly unmanaged function, why doesn't it auto-apply #pragma unmanaged to that block? 1. Managed Code - Code that compiles into IL (atleast in the first version of CLR in the next version it would be possible to have IL unmanaged functions) 2. Unmanaged Code - Code that compiles into native processor's instructions So you see there is nothing called an unmanaged function before anything gets compiled. It is perfectly legal to have global functions in managed code. ILASM can create and use it( may be VB.NET).
Rama Krishna wrote: So you see there is nothing called an unmanaged function before anything gets compiled. That's what I thought too, till it disallowed me from using the #pragma unmanaged directive to a function :( Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
-
James T. Johnson wrote: Simplicity Rules! Try saying that to Chris Losinger Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
-
James T. Johnson wrote: Simplicity Rules! Try saying that to Chris Losinger Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
:laugh: James Simplicity Rules!