Re: Dynamically loading a static C library (Updated; also compiler suggestion?)



Hello again,

First, I want to thank all of you for rushing out to help me, though I supplied so little clues. I really wanted not to bother you with unneeded details that could possibly lead the discussion to the wrong path, but in fact said not enough to be understood.

So, let me clarify the situation:

I am programming a microcontroller, ICPDAS i-8411 to be exact. (http://www.icpdas.com/products/PAC/i-8000/i-8411-i-8811.htm)
Microcontroller not in the sense of "Embedded CPU" but "a small box". A box has slots: one for CPU board and several more for I/O boards. From the programmer's point of view microcontroller is a PC. It has:
- i186-compatible CPU; 512K RAM
- 512K flash-based disk with simple filesystem
- DOS-compatible OS in boot sector
- some specific devices

Manufacturer suggests using one of the following compilers:
- Borland C++ 3.1~5.02
- MSC 6.0
- MSVC (before version 1.52)
- TC 2.01 (*available for free)
- TC++ 1.01 (*available for free)
and supplies a system library for their controller for use with one of the above compilers. Library doesn't have source and comes as .lib and ..h files. I also have some of the above compilers .

So, the proposed design cycle looks like this:
I write my program in 'C' and link against the manufacturer's library with one of recommended compilers, on Windows PC (maybe even in a DOS box). Then I transfer binary file to microcontroller using manufacturer's terminal program. I run it. Repeat until satisfied with result.

There are 2 major problems for me:

1. Proposed compilers are all old cruft.
I would like to use more up-to-date tools for programming my embedded PC. I want something that is at least either (a) non-proprietary or (b) modern, or both. The best I saw is Borland C++ 5.02 (in the modern department, but still it could use some improvement) And how do you obtain license for the compilers _that_ old? Will Borland or Microsoft grant me license for them tomorrow? (or even today) Will DOS compilers run on my computers tomorrow? (or even today)

2. No debugging.
It doesn't need explaining, I guess. Debugging is good.

So I started to think about using a Forth system on this controller. I can choose a free as in freedom Forth for DOS, put it on controller's disk and if I find a way to use system library from it, I'll be fine. With a little modification, I hope, I will have a license-free development environment with debugging. I'll also have the bonus of the compiler on the target, just in case.

I want to use the supplied library because as opposed to microcontroller as "Embedded CPU", I don't have the data*** for all my hardware. I don't get schematics, it's not practiced in the case of microcontrollers in the sense of "small box". Instead, I get system library that should fit a lineup of controllers.

So, I thought that maybe I should dynamically load the system library and gain acess to its functions. From what I gather LIB is a collection of OBJ files in the OMF format, developed by Microsoft, but later standardized. I found a bunch of information here, on the 'D' community forum: http://www.dsource.org/forums/viewtopic.php?t=959
Seems that if no one else, developers of exotic languages confront this problem?

Either that, or I could use a better development environment for 16-bit DOS. (But the debugging is out of the question, as I understand)

Previously I wrote:

I am programming an embedded controller that has a 'C' library for using its system functions (I/O, timers, all the specific devices). The supplied library has .LIB and .H files.

How can I dynamically load a LIB file and access all its functions? Surely someone has solved similar task?

My intention is to use a Forth system for programming the controller, calling library functions from it.
.