adding application path in dill import c#

hi friends,

i want to include application path in my dllimport statement when i try to declare a variable in the class it's showing build errors ..

Plz help to me .. my code sample is


[DllImport(@"E:\PAVANDV\niitflashinc#\Niitinitialize\SFlash.dll")]
public static extern int ListCardReaders (out int plRDRcount, int pbRDRlist );
[DllImport(@"E:\PAVANDV\niitflashinc#\Niitinitialize\SFlash.dll")]
public static extern int GetReaderState(int Rdrid, out int rdrstate);
[DllImport(@"E:\PAVANDV\niitflashinc#\Niitinitialize\SFlash.dll")]
public static extern int InitCardPhase1NIIT(int Rdrid,int pbvirginizekey,int pbinitializekey);

The above DllImport statement i am giving the DLL Path as static i want pass here the application executable path dynamically ..

like visualbasic code...

dim path as string = app.path & "\sflash.dll"


Thanks
pavan



Answer this question

adding application path in dill import c#

  • belleville007

    When using DllImport, you have two options... specify a relative path or just the DLL file name in the parameter... or, use a static location for the DLL.

    Also, you may want to look at the LoadLibrary() and other related API calls for non-COM and non-.NET DLL imports...

    Sam Jones
    Adaptive Intelligence
    http://www.adaptiveintelligence.net



  • dhtnh

    When using DllImport, you have two options... specify a relative path or just the DLL file name in the parameter... or, use a static location for the DLL.

    Also, you may want to look at the LoadLibrary() and other related API calls for non-COM and non-.NET DLL imports...

    Sam Jones
    Adaptive Intelligence
    http://www.adaptiveintelligence.net



  • adding application path in dill import c#