Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Code Samples & Tips
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Code Samples & Tips Share your recent discoveries and ideas with other users.


How to create a Basic4ppc library


Reply
 
LinkBack Thread Tools Display Modes
  #91 (permalink)  
Old 05-30-2008, 09:46 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,127
Default

Your main concern, if I understand you correctly, would be then to ensure that, your code is DEVICE compatible, causing it to be DeskTop compatible...
If you use some DLL that is "Normal" or "Complete" FrameWork targetted, Then Some or all the properties, controls,events or methods, may not work on the device...

As for myself, and keeping in mynd that the File dialog is somewhat limited, and only shows the files that are 1 level in to the root...(hope I'm making myself crlear, as I don't know all the correct terms), I usually place my files in a Folder, 1 Level down, in the "MyDocs" folder of my SDCard...
In Design Time, any DLL imported to the project is automatically saved to the Apps Folder, so, unless you play around a bit with wich DLL to use in your app, as I often do, all the files needed will be in the Folder...

Hope to be clear enough, and this time to be "to the point"!
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD
Reply With Quote
  #92 (permalink)  
Old 05-30-2008, 10:11 PM
Junior Member
 
Join Date: Jan 2008
Posts: 17
Default

Cableguy,

Let' start over.

An example:

I want to build a B4P library DLL that provides .Net Event processing. Using their C++ names, I will use the .Net equivalent of CreateEvent, SetEvent, ResetEvent, WaitForMultipleObjects, and CloseHandle.

All of those methods exist in both .Net for the PC and .Net CF (both 2.0) and have the same parameters.

My assumption, which could be very wrong, is that I can write one piece of source code that provides the functionality for creating an event, waiting for event to be posted, posting the event, and destroying the event.

In the simpliest case, I would have to compile that source twice, once for the PC and once for the device, in each case creating a DLL with the same name.

So far, is my assumption correct?

If so, how do I manage the source file, the two output files, and the project file?

Or, is the simpliest way to simply treat them as two different projects (one for the PC and one for the device) and manually keep the source the same in both.

Regards,
Jim
Reply With Quote
  #93 (permalink)  
Old 05-30-2008, 10:58 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,127
Default

Quote:
Originally Posted by obrienj View Post
Cableguy,

Let' start over.
Yes, let's...

Quote:
An example:

I want to build a B4P library DLL that provides .Net Event processing. Using their C++ names, I will use the .Net equivalent of CreateEvent, SetEvent, ResetEvent, WaitForMultipleObjects, and CloseHandle.

All of those methods exist in both .Net for the PC and .Net CF (both 2.0) and have the same parameters.

My assumption, which could be very wrong, is that I can write one piece of source code that provides the functionality for creating an event, waiting for event to be posted, posting the event, and destroying the event.

In the simpliest case, I would have to compile that source twice, once for the PC and once for the device, in each case creating a DLL with the same name.

So far, is my assumption correct?
Yes, very.
As I sayed before, any DLL targeting the Compact(ed) FrameWork, WILL run on bothe platforms.
Quote:
If so, how do I manage the source file, the two output files, and the project file?

Or, is the simpliest way to simply treat them as two different projects (one for the PC and one for the device) and manually keep the source the same in both.
The only Problem I forsee, is that Compilation wise, the resulting EXE file ARE diferent...
So, Yes, Two (or more, since B4PPc has added support for Smartphone compilation) diferent EXE would have to be created, trough compilation on the IDE, targeting the especific platform as needed...Still all the other files (i.e. DLL, Txt, etc) would be the same....
In some cases, especially with the legacy and forcedQVGA Mode compiling, some extra files may be created during compilation.

The souce file (.spb) does Not need to be provided with the compiled project...unless of course, you make it available for your own purposes.
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD
Reply With Quote
  #94 (permalink)  
Old 05-30-2008, 11:07 PM
Junior Member
 
Join Date: Jan 2008
Posts: 17
Default

OK, I suppose the best course is just to manually manage the projects with a PC and Device folder structure where separate project files are maintained and possibly a common source folder.

But you said one thing that I don't completely understand.

Quote:
As I sayed before, any DLL targeting the Compact(ed) FrameWork, WILL run on bothe platforms.
Are you saying the that PC and Device DLL are identical? Aren't the architectures of the CPU's different and thus the instruction set and thus the generated code or am I really missing something?

Or are you saying that by targeting .Net CF they are functionally the same, guaranteed not to use incompatible classes, BUT the actual DLL generate code is different and thus there are two DLLs, one for PC and one for device. The only things they share are use of .Net CF, their name, and source.

I had assumed that I had to have two versions of the DLL just like the B4P.exe files.

If they are different then the manual management will be fine.

Hope you have a nice weekend.

Regards,
Jim

Last edited by obrienj : 05-30-2008 at 11:15 PM.
Reply With Quote
  #95 (permalink)  
Old 05-30-2008, 11:25 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,127
Default

Quote:
Are you saying the that PC and Device DLL are identical? Aren't the architectures of the CPU's different and thus the instruction set and thus the generated code or am I really missing something?
All WIndows Mobile devices (from WM2003 up) are pre-loade with a Compact Framework.
If your DLL as been built to work with the Compact Framework, let say, 2.0, Then, as long as you also have the .Net Framework 2.0 installed in your Desktop, IT will work...
Proof os that is some of the B4PPc packaged Dll's have only one file that works both in the device and the desktop, as the Sprite.DLL, you only have to be sure you have add it in the components, to both the device and the desktop....
Some other DLL's, like CryptoDevice and CryptoDesktop, have two version, specific to their platforms...So they should be added to the correct target in components...
But the same object can be used in any case...
for instance a cryptodevice object called crypt, can also be used with the cryptodesktop, without any problem...Because the compiled file will only be using the correct DLL....and in this particular case, you only need to keep in the folder, the targeted DLL...ie, a device targeted app, developed in the desktop, will have both DLL's added in design time, but in order to run, in the device, it only needs the device version DLL...

I hope I'm beeing clear, but since english is not my mother language, I appologise for any missplelling, or missunderstanding i might have created...
Quote:
Hope you have a nice weekend.

Regards,
Jim
Thank's, i will try..
Hope your's is twice as good...
Happy codding!
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD
Reply With Quote
  #96 (permalink)  
Old 05-31-2008, 01:40 AM
Junior Member
 
Join Date: Jan 2008
Posts: 17
Default

Cableguy,

Don't worry at all about your English, you do very well. In all the years I traveled internationally with a large computer company, it always embarrassed me to not be able to speak another language but I just don't have that talent. Fortunately during the last years with that company I traveled with a guy who spoke and wrote 11 languages and picked up new ones like I drink sodas.

Anyway, I have been doing some testing and, quite frankly, playing.

Is the following true? (I think you may have already said this but it didn't sink in.)

If I compile my C# DLL targeting NET CF and I compile my B4P program as a device .exe, both will run on both platforms?

OK, if that is true, why? Is C# coupled with Net CF interpreted like Java? If not, I really need an explanation.

Regards,
Jim
Reply With Quote
  #97 (permalink)  
Old 05-31-2008, 01:51 AM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,127
Default

Quote:
Originally Posted by obrienj View Post
Cableguy,


Is the following true? (I think you may have already said this but it didn't sink in.)

If I compile my C# DLL targeting NET CF and I compile my B4P program as a device .exe, both will run on both platforms?
NO! The Dll will be useable by both a device compiled or a desktop compiled app, but, a device compiled app will NOT run in the desktop and vice-versa, even if the source file (.spb) is the same.

Quote:
Is C# coupled with Net CF interpreted like Java? If not, I really need an explanation.
Surelly there is someone with more insight knowleage than me about this issue, but as far as I know, C# is part of the .NET Framework, as well as other # languages like #j...
The main difference is that not All controls, properties, method,etc... have been provided by all those languages, as it was a prerrogative of their own developers/implementers...
the main reason that c# is so far spread in the community, is thet it seems to have the more broad coverage of the .Net Framework, thus giving the more flexible programing eviroment...
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD
Reply With Quote
  #98 (permalink)  
Old 05-31-2008, 02:11 AM
Junior Member
 
Join Date: Jan 2008
Posts: 17
Default

Cableguy,

Quote:
NO! The Dll will be useable by both a device compiled or a desktop compiled app, but, a device compiled app will NOT run in the desktop and vice-versa, even if the source file (.spb) is the same.
OK, something is strange with what I'm doing.

I compiled the DLL (MyDLL) targeting NET CF. I then compiled the B4P test program specifing Device EXE as the target.

As a reult I have only 1 MYDll.DLL and 1 test_MyDLL.exe.

I copied both to my device using ActiveSync's Explore Pocket PC and successfully ran the application.

This was as expected.

I then went back to the PC, and executed the exact same test_myDLL.exe as I had just copied to the device and IT RAN PERFECTLY.

I don't understand this.

Regards,
Jim
Reply With Quote
  #99 (permalink)  
Old 05-31-2008, 06:06 AM
dzt's Avatar
dzt dzt is offline
Basic4ppc Veteran
 
Join Date: May 2007
Location: Greece
Posts: 353
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

If you use optimised compile your device EXE will run on your desktop also. Non optimised EXE will not.

.NETCF is a subset of .NET so targeting .NETCF and staying inside the borders (do not P/Invoke for example) lets your DLL to be compatible with both device and desktop.

.NET EXEs are not platform/processor dependent (a kind like java but not exactly the same)
__________________
Dimitris Zacharakis
http://www.terracom.gr

Last edited by dzt : 05-31-2008 at 09:50 AM.
Reply With Quote
  #100 (permalink)  
Old 05-31-2008, 12:06 PM
Junior Member
 
Join Date: Jan 2008
Posts: 17
Default

dzt,

Thank you for the explanation, I thought I was going bonkers as it was not what I expected to be the case.

But having a common denominator is a good thing in some cases.

This has been fun. I guess it's what keeps me playing with computers long past my retirement. But over a 45 year career, I always enjoyed learning a new system or language.

I did notice that policing of what is and is not supported isn't all that good in either .NET or #develop.

For example, System.Threading.Mutex defines that creating a named Mutex in .Net CF isn't supported, yet if I target Net CF 2.0 (only one I tried), it compiles with no issue. I realize that the doc on MSDN maybe wrong, but either way it makes it a bit of a guessing game.

Have you had this experience?

Regards,
Jim
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create .cab file for Smartphone? RCC2k7 Questions & Help Needed 1 05-30-2008 07:02 AM
How to create a new appointment willisgt Questions & Help Needed 2 05-15-2008 08:21 PM
how to create a database ? gjoisa Questions & Help Needed 27 02-14-2008 05:38 PM
Can you help me create B4P lib? conf Questions & Help Needed 7 08-20-2007 07:41 PM
how to create spreadsheetlike function? Stellaferox Questions & Help Needed 10 06-30-2007 01:09 PM


All times are GMT. The time now is 07:43 AM.


Powered by vBulletin® Version 3.6.10
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0