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
  • Did you put only main() into axmain.obj or is there a collection of several other functions?

    In the case of putting some other functions into the same object where also main is, I got it working. But I don't understand why it depends on that.

    Perhaps it's a version issue? Which compiler/linker version do you use? I got C51 v5.50 / L51 v3.70c here.

    FRANK

Reply
  • Did you put only main() into axmain.obj or is there a collection of several other functions?

    In the case of putting some other functions into the same object where also main is, I got it working. But I don't understand why it depends on that.

    Perhaps it's a version issue? Which compiler/linker version do you use? I got C51 v5.50 / L51 v3.70c here.

    FRANK

Children