This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Putting main() into a library

Hello,

i'm trying to solve the following situation: building a library which contains some functions and also main().

The goal is, to use this as a framework and link it with a user supplied module which only contains some callback functions.

Building up the library is not the problem. Listing it with LIB51 shows:

DOS LIBRARY MANAGER LIB51 V4.01
COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 1997
LIBRARY: MYLIB.LIB
>LIB_FUNC
>>F_MY_LIB_FUNCTION
>LIB_MAIN
>>MAIN

(>'s added because the forum doesn't support blanks at beginning of line :-)

So main() seems to be put in the library as i want it.


The problem is linking it with the user supplied module. The linker does not find a root segment. So i tried to add main() as a root segment by specifying

overlay(* ! MAIN)

as a linker option. But the linker never finds main() at all.

Here's my complete linker call:

L51 user.obj, mylib.lib to mytest.abs ramsize(256) XD(0000h) overlay(* ! MAIN)


It results in:

*** WARNING 11: CANNOT FIND SEGMENT OR FUNCTION NAME
NAME: MAIN

*** WARNING 16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?F_THE_CALLBACK?USER

*** WARNING 10: CANNOT DETERMINE ROOT SEGMENT

(where F_THE_CALLBACK is a user supplied function called from within main() )

So, even the overlay manager seems not to "see" main.

Where's my mistake? Is main() processed different from other functions? Is it impossible to put main() into a library?

Thanks in advance for your help.

FRANK

Parents
  • could you please post the howto for CodeWright users
    I also set up the error parser so I can click on the error in CodeWright's output window and it takes me to the appropriate line in the source code.

    Even with this posted, I will have a small problem since I do not compile from the source code. In order to maintain 117 projects with various levels of commonality, I "pick and choose" sourcefiles from several places and (while renaming some) combine them into a build directory. Obviously editing in the build directory will not make any changes hold since these files are moved in from elsewhere.

    I love CodeWright as an editor, but I have one small beef: They have made it so "flexible" that it takes days of reading the manual to find out how to use the flexibility. Fortunetely, I figured out a long time ago with Brief how to set up the editing configurationj.

    Erik

Reply
  • could you please post the howto for CodeWright users
    I also set up the error parser so I can click on the error in CodeWright's output window and it takes me to the appropriate line in the source code.

    Even with this posted, I will have a small problem since I do not compile from the source code. In order to maintain 117 projects with various levels of commonality, I "pick and choose" sourcefiles from several places and (while renaming some) combine them into a build directory. Obviously editing in the build directory will not make any changes hold since these files are moved in from elsewhere.

    I love CodeWright as an editor, but I have one small beef: They have made it so "flexible" that it takes days of reading the manual to find out how to use the flexibility. Fortunetely, I figured out a long time ago with Brief how to set up the editing configurationj.

    Erik

Children