Welcome, Guest. Please login or register.

Author Topic: Stupid question about if it's possible to link and create two separate executables  (Read 7026 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Noster

  • Sr. Member
  • ****
  • Join Date: Jan 2004
  • Posts: 375
    • Show all replies
Hi

@Jose

Haven't read the whole thread (no time :-() but you can use a really simple fake seglist instead of a real seglist in CreateProc():

Think you have a pointer to the function that should be the entrypoint into your new process:

void (*pfv)(void);

Now you can simply get a BPTR to this function using:

BPTR sl;

sl = MKBADDR(pfv) - 1;

Now you can create your process:

struct MsgPort *mp;

mp = CreateProc ("ChildProc", DEFAULT_PRI, sl, DEFAULT_STACK);

The entry address of a function used this way must be aligned to a longword address, under SAS/C the first function of an object module can be considered appropriate for this conversion; it may have to be declared with the __saveds keyword.

This is documented in "The Amiga Guru Book" from Ralph Babel and I have tested it under every AmigaOS 1.3+. I think you will get problems if the code should be converted to OS 4.0 :-)

Noster
DON\\\'T PANIC
    Douglas Adams - Hitch Hiker\\\'s Guide to the Galaxis