thanks for the info Stephane, now i try and work, but only when i supress the "C" extern, i obtain D:\projects\plot\plot.C(7) : error C2059: syntax error : 'string'
and this is the code:
//
// plot.cpp
//
#define WIN32_LEAN_AND_MEAN
#include
extern "C" {
__declspec(dllexport) LPSTR say_hello(LPSTR cText);
}
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved )
{
return TRUE;
}
__declspec(dllexport) LPSTR say_hello(LPSTR cText)
{
return "Hola";
}
but when i supress the extern, i dont have any errors and work with VFP!,
like this:
// plot.cpp
//
#define WIN32_LEAN_AND_MEAN
#include
__declspec(dllexport) LPSTR say_hello(LPSTR cText);
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved )
{
return TRUE;
}
__declspec(dllexport) LPSTR say_hello(LPSTR cText)
{
return "Hola";
}
you can help me why send me errors? i need configure something?
thanks in advance Stephane
Best Regards
>>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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement