It is possible to call into .NET assemblies from Aurora using dynamic linking and a Managed C++ "shim" or wrapper DLL.
//============================================
// aurora bit
declare import, LoadLibraryA(name as string), int;
declare import, GetProcAddress(hModule as uint, lpfnname as string), uint;
declare import, FreeLibrary(handle as uint), uint;
def pgnetlib as unsigned int;
declare *pgnetlib_func();
declare *pgnetlib_sayhowdy();
global sub main() {
pgnetlib = LoadLibraryA("pgnetlib.dll");
if (pgnetlib)
{
pgnetlib_func = GetProcAddress(pgnetlib,"func");
pgnetlib_func();
pgnetlib_sayhowdy = GetProcAddress(pgnetlib,"sayhowdy");
pgnetlib_sayhowdy();
FreeLibrary(pgnetlib);
}
else
{
print( "!!! could not load my library..." );
}
} // ends: main
//============================================
# //////////////////////////////////////////////////////////////////////////////
# // [-pg-] 20050527 - pgnetlib build makefile
# //////////////////////////////////////////////////////////////////////////////
TARGETS=pgnetlib.dll
###CLEXE=cl /clr
###CLDLL=cl /clr /LD
all : $(TARGETS)
clean :
-@del *.obj
-@del *.exe
-@del *.c
-@del *.tlb
-@del *.idl
-@del *.h
-@del *.dll
-@del *.lib
-@del *.exp
#// [-pg-] 20050527 make sure that this code IS compiled with /clr
pgnetlib.dll : pgnetlib.cpp
cl /clr /LD /noentry
'
' Created by SharpDevelop.
' User: pieter
' Date: 2005.05.27
' Time: 11:35 PM
'
' To change this template use Tools | Options | Coding | Edit Standard Headers.
'
imports system
imports system.Windows.forms
'''imports microsoft.visualbasic
namespace pgnetlib
public class pgutil
public shared sub sayhowdy()
messagebox.show( "howdy..." )
end sub
public shared sub sayhowdy(say$)
messagebox.show( say )
end sub
end class
end namespace '// pgnetlib
// MC++ bit
#using <mscorlib.dll>
using namespace System;
//#using <pgnetlib.dll>
#using "pgnetlibvb.dll" // vb.net server
using namespace pgnetlib;
extern "C" __declspec(dllexport) void func()
{
System::Console::WriteLine(S">> [-pg-] 20030714 PGHACKED...");
System::Console::WriteLine(S">> func() called - invoked CLR");
}
extern "C" __declspec(dllexport) void pghack_proc1(char* msg)
{
System::Console::WriteLine(S">> [-pg-] 20030714 PGHACKED...");
System::Console::WriteLine(new System::String(msg));
}
extern "C" __declspec(dllexport) void sayhowdy()
{
pgutil::sayhowdy();
}
extern "C" __declspec(dllexport) void sayhowdy2(char* msg)
{
pgutil::sayhowdy(msg);
}
If anyone is interested I can provide pretty braindead zip'ed binaries that prove 3 programming language runtimes co-exist.
It would be better if you compile/nmake the bits yourself. (VC++7.1 (2003).) Let me know for help.
Thanks from me goes to Richard Grimes and his "Programming with Managed Extensions for Microsoft Visual C++ .NET" book.