Charger une DLL Dynamiquement

Résolu
Kaneda Shotaro Messages postés 48 Date d'inscription dimanche 14 août 2005 Statut Membre Dernière intervention 12 septembre 2009 - 2 mai 2006 à 16:26
Lutinore Messages postés 3246 Date d'inscription lundi 25 avril 2005 Statut Membre Dernière intervention 27 octobre 2012 - 2 mai 2006 à 18:21
Bonjour !
Je cherche comment charger une DLL dynamiquement et récuprérer l'adresse d'une fonction contenue dans celle-ci. En Delphi ça donne ça :

TInitPlugin = procedure; stdcall;var fHandle: THandle; fInit: TInitPlugin;begin fHandle :LoadLibrary(PChar(Filename)); if fHandle 0 then // Gestion de l'exception... fInit := GetProcAddress(fHandle, 'InitPlugin'); if @fInit = nil then // Gestion de l'exceptionend;
Comment traduire ça en C# ? Je programme sous Visual C# 2005 Express. Merci.

@+, Kaneda Shotaro

1 réponse

Lutinore Messages postés 3246 Date d'inscription lundi 25 avril 2005 Statut Membre Dernière intervention 27 octobre 2012 41
2 mai 2006 à 18:21
Salut, regardes cet exemple qui utilise la réflexion :

http://www.csharpfr.com/infomsg/NET-CREATION-DLL-CROISEES-LIAISON-TARDIVE_539696.aspx
3
Rejoignez-nous