Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C++ dll in C# code
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01599867
Message ID:
01599874
Vues:
63
This message has been marked as a message which has helped to the initial question of the thread.
>>>
>>>[DllImport("ww_local.dll")]
>>>static extern string Invoke1(string cInvokeString);
>>>
>>
>>Should this dll still be in the References of the project?
>>
>>Also, once declared this way, how should I call it?
>
>No, it doesn't need to be in References.
>
>Once it's declared it's basically just a static method call.
>
>
>string result = Invoke1("StringHere");
>
Just to be very clear, the DllImport/static must be in an existing class definition. Ex.
public static SampleClass
{
    [DllImport("ww_local.dll")]
    static extern string Invoke1(string cInvokeString);
}
Then you'd call it from your code:
public void DoSomething()
{
    string result = SampleClass.Invoke1("String");
}
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform