Information générale
Catégorie:
Fonctions Windows API
edward,
your problem is most probably that you are returning a pointer to a string
from
and your function type is char (single character)
Arnon
>
>I wrote a small dll that calls the localtime() function in Visual C++ 5.0.
>When I call this function,ConvertTime(), I get a memory error. The dll
>works fine because I can call the test() function. I am a Foxpro
>programmer, not a C++ programer, and I can't figure out what I am doing
>wrong. Could someone help? Here is
> the code:
>
> ///////////////////////////////////////
> //
> // ConvertTime()
> //
> ///////////////////////////////////////
>
> char ConvertTime(void)
> {
> struct tm *newtime;
> time_t aclock;
> char* rtntime;
>
> aclock=8067157205;
>
> newtime = localtime(&aclock);
>
> rtntime = asctime(newtime);
>
> return(*rtntime);
>
> }
>
>
> /////////////////////////////////////
> //
> // test()
> ////////////////////////////////////
>
> int rtn ;
>
> char test(void)
> {
> rtn = 6;
> return (rtn);
> }
>
>
> Here is the .def file
>
> ;;;;;;;;;;;;;;;;;;;;;;
> ;
> ; timeconv.def
> ;
> ;;;;;;;;;;;;;;;;;;;;;;;;;
>
> LIBRARY timeconv
> CODE PRELOAD MOVEABLE DISCARDABLE
> DATA PRELOAD SINGLE
>
> EXPORTS
> ConvertTime
> test
>
>
> Thanks
>
> Ed
>
> Thanks, Ed
>
>
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