Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Date bug in DLL ?
Message
De
01/04/2008 16:38:08
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Date bug in DLL ?
Divers
Thread ID:
01307500
Message ID:
01307500
Vues:
64
Hi all,
So I was having this weird behavior between running a DLL or the raw program. It turned out to be caused by the Date data type to change into a DateTime data type when accessed from a DLL. This will affect codes like this:
lparameter cDate
for i = 1 to 7 && days of week
   * your code passed cDate = ctod('1/1/08')
   * this has a very bad result (AND no error reported) if cDate is a DateTime data type.
   ? cDate + i
endfor

Sample code to reproduce the buggy behavior:
*oDateBug = createobject('DateBug.DateBug') && use this when testing the DLL.
oDateBug = createobject('DateBug')
oDateBug.DateProperty=ctod('3/3/08')
wait window oDateBug.GetDateProperty()
oDateBug = null
release oDateBug

define class DateBug as Session olepublic
   DateProperty = ctod('')
   procedure GetDateProperty()
      return "Type: "+type('this.DateProperty')+" Value:"+transform(this.DateProperty)
   endproc
enddefine
1. Run the program as is from VFP. The correct and expected datatype is returned.
2.1 Create a DateBug project and add the code. Set Main. Compile DLL.
2.2 Uncomment the first line and comment the second line then run the code. DateTime type is returned when the code uses the DLL.

See related thread: Thread ID: 1307380 Message ID: 1307380
ramil
~~ learning to stand still
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform