DLM unload [message #63070] |
Wed, 22 October 2008 09:46  |
olmeca
Messages: 4 Registered: October 2008
|
Junior Member |
|
|
Hi,
I'm programming a DLM and i wan't to know if it is anyway to unload a
DLM besides de ".FULL_RESET_SESSION" directive.
Cheers
Felipe
|
|
|
Re: DLM unload [message #63156 is a reply to message #63070] |
Tue, 28 October 2008 19:19  |
olmeca
Messages: 4 Registered: October 2008
|
Junior Member |
|
|
This is the continuation of the post..
It's worth metion that this dlm effectively reloads the dlm when i
recompile it.
I hope that will be useful for someone (at least it's for me ;)
/* dlm_wrapper.c */
/* Standard Libraries */
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
/* IDL Libraries */
#include "idl_export.h"
IDL_VPTR dlm_wrapper(int argc, IDL_VPTR *argv) {
void *lib_handle;
IDL_VPTR (*fn)(int, IDL_VPTR *);
char *func_name;
char *lib_file;
IDL_VPTR result;
/* The parameters are the shared object (dll) and the function */
func_name = IDL_VarGetString(argv[0]);
lib_file = IDL_VarGetString(argv[1]);
/* Call dyanmically the library as usual */
lib_handle = dlopen(lib_file, RTLD_LAZY);
if(!lib_handle) {
printf("%s\n", dlerror());
return IDL_StrToSTRING("Error on lib_name\n") ;
}
fn = dlsym(lib_handle, func_name);
if((dlerror() != NULL)) {
printf("%s\n", dlerror());
dlclose(lib_handle);
return IDL_StrToSTRING("Error on func_name\n");
}
/* Call the method with the rest of the arguments from IDL */
result = (*fn)(argc-2, (argv+2));
dlclose(lib_handle);
return result;
}
static IDL_SYSFUN_DEF2 main_def[] = {
{(IDL_SYSRTN_UNION)dlm_wrapper, "DLM_WRAPPER", 0, 100, 0, 0}
};
int IDL_Load(void) {
return IDL_SysRtnAdd(main_def, TRUE, IDL_CARRAY_ELTS(main_def));
}
On Oct 28, 11:16 pm, olm...@gmail.com wrote:
> Finally i've found a solution, it isn't clean nor portable but for my
> objectives works.
>
> I've made a "dlm_wrapper" DLM, so that dlm (that it's loaded 1 time)
> load the method of the dlm
> that i wan't to debug. Here's the code it works on OSX (and should
> work on linux) and loads functions.
>
> On Oct 27, 5:14 pm, olm...@gmail.com wrote:
>
>> Unfortunately that's doesn't work because dlms are loaded diffrent.
>
>> I think that there must be a way to unload a dlm, if not debugging
>> it's way too painful.
>
>> Thanks anyway.
>> Felipe
>
>> On Oct 22, 5:42 pm, Robbie <ret...@iinet.net.au> wrote:
>
>>> I don't know about DLMs, but if you manually load the library using
>>> CALL_EXTERNAL(Image,/UNLOAD) then it should do what you want.
>
>>> Cheers,
>
>>> Robbie
>
>
|
|
|