Problem with Serial. ("before loop" error)

jesb4ppc

Member
Licensed User
Hi everyone,
:sign0085:
I've developed a small program based on GPS4PPC, (it just shows more info from NMEA sentences), which works fine, both on Desktop and Device.

I've upgrade prior working version of basic4ppc, from 5.8 to 6.05, and now I get some strange problems with SerialDevice.

First, I re-compiled my source (replace SerialDevice and DBcomm with Serial2.dll) and get an exe. Put needed libraries on Storage Card, on Device, and despite of Serial2.dll is in the same directory than the .exe file, when I try to run the exe I got a msgBox with

" Error loading program.
\Storage Card\B\Serial2.dll "

but Serial2.dll is in that directory (?). I've copied it two or three times on the card, just in case it was corrupted, but the error keeps appearing.

I've copied and old compiled version of the program, (with 5.8), which uses SerialDevice.dll and DBcom.dll, (put also the dlls on device) and when I click on it, I got the following messages boxes:

Serial Device. <-title of the box
"before loop"

click ok, and I got:

serial device
1
0
(ok)

serial device

7007

(ok)
serial device

2

(ok)

and then the program stops.

Does anybody has any idea of whats happening? Why does it work before and not now?
Is it better to downgrade to 5.8?

Thank you,


Jes.
 

alfcen

Well-Known Member
Licensed User
Longtime User
Hi Jes,
Just to rule out all odds, is .NET Compact Framework 2.0 installed on your device? The Ver 6.05 (optimized) compiler targets 2.0 as does serial2.dll.
Cheers
Robert
 

jesb4ppc

Member
Licensed User
keep trying

Hi alfcen,

Yes, .Net CF 2.0 is installed. It's a Qtek S200, and it has also a newer version than the one (V2.0.50727) I tried to install.

I have partially solved the problem; If I copied the old .exe to the Device, it works but I can´t re-compile and create a new working .exe. I'm quite disconcerted about this...

Thank you for your time.
 

agraham

Expert
Licensed User
Longtime User
Re your Serial2.dll loading probllem, I think you may have a Framework version problem. I believe that your device will have .NET 1.0 in ROM and that .NET 2.0 has been installed as well.

Dbasic.exe, v5.8 compiled exes and v6.05 legacy compiled exes are all .NET 1.0 apps and will preferentially run under 1.0 even if 2.0 is available. If .NET 1.0 is not available then they will automatically run under 2.0 without problem.

If an app wants to run with a .NET 2.0 library AND both Framework versions are present then an appname.exe.config file is required to be in the same folder as the compiled app to force .NET 2.0 operation. Dbasic produces this automatically. I suspect your problem is that you have legacy compiled your app under v6.05 and have not copied this config file to the device.

If an app wants to run with a .NET 2.0 library and only Framework version 1.0 is present then the app will not run.

If an app wants to run with a .NET 2.0 library and only Framework version 2.0 is present then the app will run fine without a config file.

Optimised compiled v6.05 exes are .NET 2.0 exes and will only run under .NET 2.0. They do not need a config file. If you optimise compile under v6.05 then I would expect your app to work fine.

This also applies to desktop exes. Dbasic installation comes with a dbasic.exe.config file so that Dbasic.exe runs under .NET 2.0 if it is present even if .NET 1.0 or 1.1 is present on the desktop.

A little more information here http://www.b4x.com/netcf2.html
 
Last edited:
Top