Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
FLL Parameters
Message
Information générale
Forum:
Visual C++
Catégorie:
Autre
Titre:
Divers
Thread ID:
01672518
Message ID:
01672526
Vues:
35
Hi Martina,

I saw that all samples are like that, but when I tried the compiler complains

Error (active) E0144 a value of type "const char *" cannot be used to initialize an entity of type "char *"

and

Error C2440 'initializing': cannot convert from 'const char [3]' to 'char *' FLLTest


That is why I made the conversion

[Update]
Forgot to mention that the same problem (need to convert "" to (char *) or (char FAR *)) happens if I enclose the whole thing in a extern "C" block.
[/Update]

[Update 2]
Following this link https://docs.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2440?view=vs-2019
I added the option /Zc:strictStrings to no avail :(
[/Update 2]

[Update 3]
I did not see there was a minus symbol after /Zc:strictStrings, so I added it and now I can compile as you suggested (no need to convert the string) but still the parameter comes as NULL arghh...
[/Update 3]

>Hi Hugo,
>
>
>
>FoxInfo myFoxInfo[] =
>{
>   {"USINGPARAMETER", (FPFI)UsingParameter, 1, "N"},
>   {"NOTUSING", (FPFI)NotUsing, 0, ""},
>};
>
>
>MartinaJ
>
>>I am trying to create an FLL, and getting nowhere right from the start...
>>
>>If I call a parameter-less function, it works as expected, no problemo, but as soon as I try to use parameters, the function receives a null pointer as parameter instead of the structure that is supposed to be receiving, I run out of ideas... well, the only one I had is that I was targetting 64 bits instead of 32, but I checked and I am not, and anything I try does not help either... any ideas?
>>
>>A simple repro code
>>
>>
>>// FLLTest.cpp : Defines the exported functions for the DLL application.
>>//
>>#include "stdafx.h"
>>#include "pro_ext.h"
>>
>>void FAR NotUsing(ParamBlk FAR *param) {
>>	_PutStr((char FAR *)"Hello from an FLL\n");
>>}
>>
>>void FAR UsingParameter(ParamBlk FAR *param) {
>>	// This will work as long as I do not try to use param
>>	_PutStr((char FAR *)"If I try to use param, it is null so it will crash the program\n");
>>}
>>
>>FoxInfo myFoxInfo[] =
>>{
>>   {(char *) "USINGPARAMETER", (FPFI)UsingParameter, 1, (char *)"N"},
>>   {(char *)"NOTUSING", (FPFI)NotUsing, 0, (char *)""},
>>};
>>
>>extern "C" {
>>	FoxTable _FoxTable =
>>	{
>>	   (FoxTable *)0, sizeof(myFoxInfo) / sizeof(FoxInfo), myFoxInfo
>>	};
>>}
>>
>>
>>In the screen shot attached you can see that the parameter-less function worked, and you can see the one that receives a parameter receives a null from VFP
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform