Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Building dlls
Message
De
29/08/2001 14:52:35
 
Information générale
Forum:
Visual C++
Catégorie:
Autre
Titre:
Divers
Thread ID:
00550118
Message ID:
00550495
Vues:
16
>hello, i try to dev a dll for calc, but i have 2 questions:
>
>1. how i can return a text in a __declspec(dllexport) and

Set your function to return a LPSTR and pass the string by reference. For example:

extern "C" __declspec(dllexport) LPSTR say_hello(LPSTR cText) { return cText; }

In VFP:
DECLARE STRING say_hello IN ("lib.dll") STRING @cText
?say_hello("HELLO!")

(Should write "HELLO!" without the double quotes)


>
>2. i build this code:
>
>// mcd.cpp
>//
>#define WIN32_LEAN_AND_MEAN
>#include
>__declspec(dllexport) int mcd(int u,int v);
>
>BOOL APIENTRY DllMain( HANDLE hModule,
> DWORD ul_reason_for_call,
> LPVOID lpReserved )
>{
> return TRUE;
>}
>__declspec(dllexport) int mcd(int u,int v)
>{
> int t;
> while (u<0); > {
> if (u> u=u-v; > }
> return v;
>}
>
>
>why dont run?, i build an dll with 0 errors, but when i run from VFP i obtain: this function dont found in the library?
>

OK! Why all the > here and there? Plus, your while loop will not do a thing since you terminate it (probably need to remove the ; after it and add some code) Other than that, use the same header for the function as the one I wrote in your first question and it should work.

If not, are you sure that you chose a DLL project and not a console application (or another type of project) when you created your project? It doesn't look like it by the #include and #define you are using.

>Thanks in advance
>
>with best Regards
>
>Francisco Morosini
>

Good luck, Stephane.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform