Hello,
Is there a way to load a .NET assembly from a Delphi win 32 application without
using COM?
I've found things like MSCOREE.DLL, ClrCreateManagedInstance and
CorBindToRuntimeEx, but i can't put them together to get them working.
This is what i've got so far:
unit Unit3;
interface
type
InxInterface = Pointer;
TClrCreateManagedInstance = function(aTypeName: PWideChar; const aInterface:
TGUID; out aObject):
HRESULT; stdcall;
function LoadManagedClass(aClassName, anAssemblyName: ShortString; const
aInterface: TGUID): InxInterface; stdcall; Export;
implementation
uses
sysutils, stdctrls, windows, Dialogs;
function LoadManagedClass(aClassName, anAssemblyName: ShortString; const
aInterface: TGUID): InxInterface; stdcall; export;
var
netClass: WideString;
assembly: Integer;
ClrCreateManagedInstance: TClrCreateManagedInstance;
dllInst: HINST;
begin
result := nil;
assembly := -1;
anAssemblyName := ExtractFileName(anAssemblyName);
netclass := aClassName + ', ' + anAssemblyName;
dllInst := LoadLibrary('mscoree.dll');
if dllInst <> 0 then
begin
//GetProcAddress(dllInst, 'CorBindToRuntimeEx')
ClrCreateManagedInstance :=
TClrCreateManagedInstance(GetProcAddress(dllInst, 'ClrCreateManagedInstance'));
{ the dllInst does return a valid value
GetProcAddress(dllInst, 'ClrCreateManagedInstance') does return nil
}
if assigned(ClrCreateManagedInstance) then
assembly := ClrCreateManagedInstance(PWideChar(netclass), aInterface,
Result);
end;
if assembly <> 0 then
end;
end.
So the dll is loadeds, but 'ClrCreateManagedInstance' is noit found.
Any suggestions, or even better a sample code would be appreciated.
Regards
Andries
---------------------------------
Blab-away for as little as 1ยข/min. Make PC-to-Phone Calls using Yahoo!
Messenger with Voice.
[Non-text portions of this message have been removed]
-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/delphi-en/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/