Re: /DELAYLOAD Linux counterpart for shared objects



On 23 Juni, 14:27, David Schwartz <dav...@xxxxxxxxxxxxx> wrote:
On Jun 23, 2:28 am, per...@xxxxxxxxx wrote:

Here is what I understand: Dlsym returns a function pointer, which can
be used to call the function, and I can of course collect the pointers
in an array. A big disadvantage is that the compiler, as far as I
know, won't check any parameters of the calls to the .so. I don't know
anything about the proposed ELF solution.

The compiler will still check the parameters, so long as you ask it
to.

For example, assume that the library contains a function called
'some_library_func'. Assume that your code will only call this
function if the library exists and the function can be resolved in it
(you need some kind of 'loader' function that fills in all the
pointers and makes sure the library is there). Your wrapper looks like
this:

int some_library_func(int foo, void *bar)
{
return my_table->some_library_func(foo, bar);

}

Thanks, David!
No solution without writing wrapper functions? I'm shuddering for
declaring a function pointer to the following example of function in
the library in question:
sword OCIEnvNlsCreate (OCIEnv **envp, ub4 mode, dvoid *ctxp,
dvoid *(*malocfp)(dvoid *ctxp, size_t size),
dvoid *(*ralocfp)(dvoid *ctxp, dvoid *memptr, size_t
newsize),
void (*mfreefp)(dvoid *ctxp, dvoid *memptr),
size_t xtramem_sz, dvoid **usrmempp,
ub2 charset, ub2 ncharset);
/Per
.



Relevant Pages

  • Re: new IL: C (sort of...).
    ... only for "recent" Pascals, ... far pointers weren't really limited, ... in my compiler, I made wchar_t a builtin type (in most cases, aliased to ... I could very well include builtin "managed strings" in the new IL. ...
    (comp.lang.misc)
  • Re: new IL: C (sort of...).
    ... and the frontend compiler needs to be able ... Having very limited pointers is a fact of life in a VM language though, ... vague claims about Pascal's pointer support. ... That is pretty normal for standards (the ...
    (comp.lang.misc)
  • Re: code optimiation
    ... Given that the compiler can often optimise the generated code to use the best sized types available, it's seldom worth specifying "fast" types explicitly. ... pointers and floating point types whose "zero value" might not be all- ... instruction, so the assembler produced for *p++ when used as the ... It will do the same job, and let you write the source code using proper array constructs. ...
    (comp.arch.embedded)
  • Re: Garbage collection
    ... void fn{ ... void* const buf1 = malloc; ... If compiler can detect that 'fne' does not cache a pointer somewhere, it can possibly detect that 'buf1' goes out of scope at 'L2'. ... Some GC implementations that will actually scan the stack of all application threads for pointers into its managed heaps, and attempt to follow all the links to NULL. ...
    (comp.lang.c)
  • Re: Scheme and libraries -- piggyback on Java?
    ... pointers to be assigned to other pointer types without casting. ... I suppose I did know at one time that void* was convertible without ... I also just realized that I haven't used an actual C compiler since ...
    (comp.lang.scheme)