4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 2000 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include <fcode/private.h>
35 do_dlopen(fcode_env_t
*env
)
42 name
= pop_a_string(env
, NULL
);
43 pl
= dlopen(name
, mode
);
44 PUSH(DS
, (fstack_t
)pl
);
48 do_extend(fcode_env_t
*env
)
51 PUSH(DS
, (fstack_t
)RTLD_NOW
);
57 do_dlclose(fcode_env_t
*env
)
59 void *pl
= (void *)POP(DS
);
64 do_dlsym(fcode_env_t
*env
)
69 name
= pop_a_string(env
, NULL
);
71 d
= (fstack_t
)dlsym((void *) d
, name
);
76 do_dlexec(fcode_env_t
*env
)
80 fstack_t (*fn0
)(void);
81 fstack_t (*fn1
)(fstack_t
);
82 fstack_t (*fn2
)(fstack_t
, fstack_t
);
83 fstack_t (*fn3
)(fstack_t
, fstack_t
, fstack_t
);
84 fstack_t (*fn4
)(fstack_t
, fstack_t
, fstack_t
, fstack_t
);
91 fn0
= (fstack_t (*)(void)) a
;
97 fn1
= (fstack_t (*)(fstack_t
)) a
;
104 fn2
= (fstack_t (*)(fstack_t
, fstack_t
))a
;
112 fn3
= (fstack_t (*)(fstack_t
, fstack_t
, fstack_t
))a
;
121 fn4
= (fstack_t (*)(fstack_t
, fstack_t
, fstack_t
, fstack_t
))a
;
137 fcode_env_t
*env
= initial_env
;
142 FORTH(0, "dl-open", do_dlopen
);
143 FORTH(0, "dl-close", do_dlclose
);
144 FORTH(0, "dl-sym", do_dlsym
);
145 FORTH(0, "dl-exec", do_dlexec
);
146 FORTH(IMMEDIATE
, "extend-from", do_extend
);