1 /* $Id: dlsym.c,v 1.2 2002/02/20 09:17:56 hyperion Exp $
4 * COPYRIGHT: See COPYING in the top level directory
5 * PROJECT: ReactOS POSIX+ Subsystem
6 * FILE: subsys/psx/lib/psxdll/dlfcn/dlsym.c
7 * PURPOSE: Obtain the address of a symbol from a dlopen() object
8 * PROGRAMMER: KJK::Hyperion <noog@libero.it>
13 #include <ddk/ntddk.h>
14 #include <ntdll/rtl.h>
15 #include <ntdll/ldr.h>
17 #include <psx/dlfcn.h>
18 #include <psx/errno.h>
19 #include <psx/debug.h>
21 void *__dlsymn(void *, unsigned long int);
22 void *__dlsym(void *, int, const char *, unsigned long int);
24 void *dlsym(void *handle
, const char *name
)
26 return (__dlsym(handle
, 1, name
, 0));
29 void *__dlsymn(void *handle
, unsigned long int ordinal
)
31 return (__dlsym(handle
, 0, 0, ordinal
));
34 void *__dlsym(void *handle
, int by_name
, const char *name
, unsigned long int ordinal
)
36 struct __dlobj
* pdloObject
;
41 if(handle
== RTLD_NEXT
)
43 FIXME("implement RTLD_NEXT semantics");
47 pdloObject
= (struct __dlobj
*) handle
;
49 if(pdloObject
->global
)
51 FIXME("implement global symbol matching");
59 RtlInitAnsiString(&strName
, (LPSTR
)name
);
61 nErrCode
= LdrGetProcedureAddress
72 nErrCode
= LdrGetProcedureAddress
81 if(!NT_SUCCESS(nErrCode
))
83 __dl_set_last_error(__status_to_errno(nErrCode
));