Hi people!!!

Is it posible to call functions from MSCORLIB, as I do with KERNEL32 or USER32 ??? Do I need to initialize classes or something else before??

Thanks!
Posted on 2006-06-09 22:08:14 by bimas
Please clarify:

Do you want to instantiate a .NET object and call it from your program?
Posted on 2006-06-09 22:29:51 by comrade
Yes. I'm learning .NET and I wanna know if it's possible to use its objects, like methods or properties, with ASM.

Thanks!
Posted on 2006-06-10 14:59:58 by bimas
You probably can, but it will probably be more like COM rather than WINAPI.

VC (starting at ver 7 ?) can create mixed managed/unmanaged code modules. So you can research one possible way to mix them. You might also find useful information in the VC docs. Very useful information is often provided during the transition period, when management of mixed code is still being learned. Literature on MSIL or the CLR can also provide interfacing information.

Because objects can move around during GC, you need to code accordingly. Basically, you cannot keep private copies of .NET generated or compatible object addresses and expect them to be valid later on.

You do need to initialize the .NET environment for each process that is launched.
Posted on 2006-06-10 16:34:37 by tenkey
ObjAsm32 provides support for interacting with and authoring both C++ and COM objects and also arbitrary interfaces.
It's essentially a macro toolkit for use with the MASM assembler, but it's a lot more powerful and useful than that description suggests..
Posted on 2006-06-11 02:47:25 by Homer
Yes. Probably the most straightforward way for you would be to create a COM interop. It is essentially a gateway to the .NET object, wrapped around a COM interface. Then you can standard COM API/techniques to access the object.
Posted on 2006-06-11 05:12:12 by comrade
I have been thinking if there is no way to access this objects directly, like we do today... I don't know for sure, but certainly we will get a time when Windows will no longer provide Win32 API, just .NET methods. So what will happen then???

Thanks!
Posted on 2006-06-11 10:25:26 by bimas

I don't know for sure, but certainly we will get a time when Windows will no longer provide Win32 API, just .NET methods. So what will happen then???

<rant>
Even VISTA, which afaik is based on dotNET and has a new API, will have a win32 emulation layer. So we'll still have the win32 api for, what, at least 10 years from now. We'll probably even still be running intel processors, even though most will have shifted to x86-64 capable ones.

I hope windows will lose a lot of marketshare, though... I really don't like the direction MS is taking with Vista. Unfortunately, the only real alternative to Windows is Mac OS X, and apple are at least as nasty fascists as Microsoft :)
</rant>
Posted on 2006-06-11 10:31:08 by f0dder
What about the 'other alternative'?
I'm considering going back there.
Posted on 2006-06-11 11:41:40 by Homer

What about the 'other alternative'?
I'm considering going back there.

Which other alternative?

Windows will be alive for a while, but 2k is not a "live" system anymore, and XP will also be killed off updates. Linux and other friends aren't alternatives to me.
Posted on 2006-06-11 14:38:00 by f0dder
Vista isn't really based on .NET :)
It is all still Win32 API, and there is a .NET assembly which wraps around Win32 API (all user mode). Win32 API will stay as long as Windows will - it would be a tremendous appcompat headache to take it away.

f0dder what don't you like about the direction MS is taking Vista?
Posted on 2006-06-11 21:19:12 by comrade

It is all still Win32 API, and there is a .NET assembly which wraps around Win32 API (all user mode). Win32 API will stay as long as Windows will - it would be a tremendous appcompat headache to take it away.

Hm, I thought it was the other way around - win32 API as a wrapper on dotNET. How else can they justify those insane machine requirements? ;)


f0dder what don't you like about the direction MS is taking Vista?

Even more fisherprice than XP, too much DRM (I've heard rumors of a kernel thread calling BugCheck() if it sees modifications to Windows Media Player), etc. Not my cup of tea.
Posted on 2006-06-12 04:36:12 by f0dder