Accessing .NET code from Xojo

Hello

I was reading into accessing .Net code from Xojo. I stumbled upon this article: Click
But I was wondering, can’t I just create a DLL in C# and access it via declares?

And as an extra question, is it possible to use GUI objects via declares? Can’t find anything in the docs about GUI objects.

Thanks

Well, no. C#, like any .NET language, creates managed code. These are not the same as DLLs you’d create using C/C++ without .NET.

You can certainly create Declares to GUI objects. The Declare page in the LR has examples that display a MessageBox on Windows and there are several examples that modify Cocoa-specific settings for a Window.

You might want to check out the Windows Functionality Suite if you are looking for more examples of Window declares. And macoslib for OS X.

[quote=131226:@Paul Lefebvre]Well, no. C#, like any .NET language, creates managed code. These are not the same as DLLs you’d create using C/C++ without .NET.

You can certainly create Declares to GUI objects. The Declare page in the LR has examples that display a MessageBox on Windows and there are several examples that modify Cocoa-specific settings for a Window.

You might want to check out the Windows Functionality Suite if you are looking for more examples of Window declares. And macoslib for OS X.[/quote]

I just created a functional DLL in VB. NET that I access through the technique described on the blog. It is a .NET language, and yet it works fine.

There is actually a way to do this via a nuget package called UnmanagedExports. I’ve used it and it works very well for wrapping C# dlls in a way that makes calling them from Xojo’s declare syntax a breeze. See https://www.nuget.org/packages/UnmanagedExports

Right. The .NET DLL needs to be wrapped in some way. The blog technique (all credit to Jim Cramer for outlining it) is one way. But you cannot just use the DLL as-is.