[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

BillyJ

6/15/2016 5:09:00 PM

Traced the code to where it fails.
Added TraceMessage to show where execution stopped.
TraceMessage pumps message to external monitor app.

This runs OK in IDE either Step or Run.
This fails as.EXE now but worked before.
I only made a few changes unrelated to this code.

in the class clsSunInfo
Public Function CitiesGet() As String()

' provide a pick list of cities

On Error Resume Next

Dim lCityIx As Long

' asCities is local
ReDim asCities(0 To UBound(m_tCities)) As String

For lCityIx = 0 To UBound(m_tCities)
asCities(lCityIx) = m_tCities(lCityIx).Name

Next lCityIx

CitiesGet = asCities
TraceMessage "CitiesGet End" ' get here in IDE but not in EXE

End Function 'CitiesGet

' Called as ( vCity is a Variant )
Set cSunInfo = New clsSunInfo
For Each vCity In cSunInfo.CitiesGet
TraceMessage "Load 4" ' DOES NOT MAKE IT TO HERE WHEN .EXE
cboCities.AddItem vCity

Next vCity


' === more info ===
I checked an older version and found this.
The area of code in question is identical.
The compiled version that was already there works.
I saved that older .EXE.
I compiled the older version with these results.
The IDE version runs
The compiled version FAILS exactly the same as the new version failed.

So I do not think it is my code but something else.

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
13 Answers

BillyJ

6/15/2016 10:26:00 PM

0

Went to a different PC and compiled the app with no change in source code.

It runs in the IDE.
It produces a .EXE that runs perfectly.

Now what?
Suggestions please.

mm

6/16/2016 3:52:00 AM

0


"BillyJ" <BJ@spamfree.com> escribió en el mensaje
news:njskl1$9ts$2@gioia.aioe.org...
> Went to a different PC and compiled the app with no change in source code.
>
> It runs in the IDE.
> It produces a .EXE that runs perfectly.
>
> Now what?
> Suggestions please.


Try to find out what is the exact line that produces the error.

Example:

ReDim asCities(0 To UBound(m_tCities)) As String

Msgbox "1"
For lCityIx = 0 To UBound(m_tCities)
Msgbox "2"
asCities(lCityIx) = m_tCities(lCityIx).Name
Msgbox "3"
Next lCityIx
Msgbox "4"
CitiesGet = asCities
Msgbox "5"


BillyJ

6/16/2016 4:38:00 PM

0

That is what TraceMessage does.

It fails at

For Each vCity In cSunInfo.CitiesGet


The version compiled on another PC that works when brought back to the
first PC also works. It is a compile on the first computer problem.

Many other large and complex apps are compiled on this first PC with NO
problems of compiled .EXE; however, none have this type of line of code
where an array is returned by cSunInfo.CitiesGet for the For Each.


mm

6/16/2016 6:44:00 PM

0


"BillyJ" <BJ@AIOESPAM.COM> escribió en el mensaje
news:njukll$11ga$1@gioia.aioe.org...
> That is what TraceMessage does.
>
> It fails at
>
> For Each vCity In cSunInfo.CitiesGet

Try changing the code:

Dim c as Long
Dim vCit

Set cSunInfo = New clsSunInfo
vCit = cSunInfo.CitiesGet
For c = LBound (vCit) to UBound (vCit)
cboCities.AddItem vCit(c)
Next c


BillyJ

6/16/2016 6:46:00 PM

0

First PC (where it fails as .EXE)
Compiled to P Code and it works.
Complied to EXE with no optimizations and it FAILS.

How to locate the compiler and linker to get the versions or is it the
vb runtime? Suggestions please.


--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

BillyJ

6/16/2016 6:48:00 PM

0

Eduardo wrote:
> Try changing the code:
>
> Dim c as Long
> Dim vCit
>
> Set cSunInfo = New clsSunInfo
> vCit = cSunInfo.CitiesGet
> For c = LBound (vCit) to UBound (vCit)
> cboCities.AddItem vCit(c)
> Next c
>
>
There all types of workarounds but it should work as written.

mm

6/16/2016 7:03:00 PM

0


"BillyJ" <BJ@AIOESPAM.COM> escribió en el mensaje
news:njus8a$1dd1$2@gioia.aioe.org...
> Eduardo wrote:
>> Try changing the code:
>>
>> Dim c as Long
>> Dim vCit
>>
>> Set cSunInfo = New clsSunInfo
>> vCit = cSunInfo.CitiesGet
>> For c = LBound (vCit) to UBound (vCit)
>> cboCities.AddItem vCit(c)
>> Next c
>>
>>
> There all types of workarounds but it should work as written.

First try to find out if the workaround actually works (or not).
Then you'll be able to narrow down to what can be causing the problem.
It is a detective work, you need to be patient.

Second "workaround":

Public Function CitiesGet() As Variant


Third "workaround":

Dim vCities as Variant

Set cSunInfo = New clsSunInfo
vCities = cSunInfo.CitiesGet
For Each vCity In vCities
cboCities.AddItem vCity
Next vCity


More workarounds: combine 1, 2 and 3 workaround.


Larry Serflaten

6/17/2016 12:02:00 AM

0

BillyJ wrote:
> First PC (where it fails as .EXE)
> Compiled to P Code and it works.
> Complied to EXE with no optimizations and it FAILS.
>
> How to locate the compiler and linker to get the versions or is it the
> vb runtime? Suggestions please.


My vague recollection is that it had something to do with type checking.
Pcode was a little more tolerant to casting types such as when you try
to use an array as a collection, or (probably) when you try to convert
the variable asCities() As String, to getCities as String().

Try changing the function type to Variant:

Public Function CitiesGet() As Variant

See if that gets you farther along....

LFS

Larry Serflaten

6/17/2016 12:10:00 AM

0

BillyJ wrote:
> First PC (where it fails as .EXE)
> Compiled to P Code and it works.
> Complied to EXE with no optimizations and it FAILS.
>
> How to locate the compiler and linker to get the versions or is it the
> vb runtime? Suggestions please.


<duplicate post, first seems to have got lost>

IIRC the issues between Pcode and OBJ code had to do with type checking.

It may be it doesn't like casting asCities() As String to getCities As String().

Try declaring the function as a Variant and see if that gets you farther along.

LFS

BillyJ

6/17/2016 4:07:00 PM

0

Larry, the bottom like question is WHAT does not like it since on one PC
there is no problem and all works well but on the second PC if fails as EXE.
I can do workarounds but some is rotten and am wondering if there are
other things that will get screwed up and we will not know it when run
as .EXE.

So where might this problem arise from?
Compiler, linker, runtime or what?
and how do I check?
What files should I consider looking at?
How do I compare? Get versions etc. Rely on date or what?


--- news://freenews.netfront.net/ - complaints: news@netfront.net ---