Hallo,
ich habe viel zum Thema gefunden, leider keine Antworten.
Ich möchte in C# eine Library erstellen und diese ohne COM-Objekt zur Laufzeit einbinden. Geht das überhaupt?
Beispiel der Dll:
C#-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17:
| using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace ClassLibrary1 { public class Class1 { public string Test( string param ) { Form1 TestForm = new Form1(); TestForm.ShowDialog(); return param; } } } |
Wie binde ich die nun in Delphi ein?
Hatte es so mal versucht:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22:
| ... Type TFNOneFunction = function(param: String): string; stdcall; ... Var myfunction : TFNOneFunction; myDLLhandle : Thandle; begin myDLLhandle:=LoadLibrary('ClassLibrary1.dll'); myfunction := nil; If myDLLhandle <> 0 then begin @myfunction := GetProcAddress(myDLLhandle,'ClassLibrary1.Class1.Test'); If @myfunction <> nil then myfunction('test') else showmessage('error');
FreeLibrary(myDLLhandle); end else showmessage('error'); end; |
Geht leider nicht. Wie macht man es denn richtig?
Gruß Marius