Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #145706

Re: Calling a machine code/binary function given its address, return type, & parameter types

Subject Re: Calling a machine code/binary function given its address, return type, & parameter types
Newsgroups comp.lang.c
References <66319c70-be79-466d-ba04-f8bb1b2d3a8a@googlegroups.com> <ln5zmv5tpo.fsf@kst-u.example.com>
From Richard Damon <Richard@Damon-Family.org>
Message-ID <kH06F.12371$9i3.9733@fx42.iad> (permalink)
Organization Forte - www.forteinc.com
Date 2019-08-17 20:09 -0400

Show all headers | View raw


On 8/17/19 6:10 PM, Keith Thompson wrote:
> David Williams <dwilliams1664@gmail.com> writes:
...
>> The platform is 64-bit Linux (x86-64).
> 
> Others have discussed how you can do this *if it can be done*.  But
> there is no way to do this in portable C.  But since you're dealing with
> calling machine code routines, you're probably not too concerned about
> portability.
> 

Actually, since he knows the platform and that has been specified, he
probably only really needs portable on that platform. I am pretty sure
the ABI for that platform says that uintptr_t will exist and alias the
same type as uint64_t which I think is unsigned long long (not as sure
on that last point).

I am also pretty sure that the platform ABI will define how casting that
type to a function pointer will work (Linux has needs for that operation
for things like share libraries, so they will define how it should work).

Given that, assuming he is using a proper compiler for the environment,
it should work.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Calling a machine code/binary function given its address, return type, & parameter types David Williams <dwilliams1664@gmail.com> - 2019-08-17 06:58 -0700
  Re: Calling a machine code/binary function given its address, return type, & parameter types Richard Damon <Richard@Damon-Family.org> - 2019-08-17 10:14 -0400
  Re: Calling a machine code/binary function given its address, return type, & parameter types Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-08-17 07:17 -0700
  Re: Calling a machine code/binary function given its address, return type, & parameter types Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-08-17 15:26 +0100
  Re: Calling a machine code/binary function given its address, return type, & parameter types Siri Cruise <chine.bleu@yahoo.com> - 2019-08-17 12:15 -0700
  Re: Calling a machine code/binary function given its address, return type, & parameter types Bart <bc@freeuk.com> - 2019-08-17 20:34 +0100
    Re: Calling a machine code/binary function given its address, return type, & parameter types Keith Thompson <kst-u@mib.org> - 2019-08-17 14:31 -0700
  Re: Calling a machine code/binary function given its address, return type, & parameter types Keith Thompson <kst-u@mib.org> - 2019-08-17 15:10 -0700
    Re: Calling a machine code/binary function given its address, return type, & parameter types Richard Damon <Richard@Damon-Family.org> - 2019-08-17 20:09 -0400
      Re: Calling a machine code/binary function given its address, return type, & parameter types Keith Thompson <kst-u@mib.org> - 2019-08-17 17:54 -0700
  Re: Calling a machine code/binary function given its address, return type, & parameter types David Williams <dwilliams1664@gmail.com> - 2019-08-18 09:57 -0700
    Re: Calling a machine code/binary function given its address, return type, & parameter types Bart <bc@freeuk.com> - 2019-08-18 18:37 +0100
    Re: Calling a machine code/binary function given its address, return type, & parameter types Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-08-18 21:40 +0100
    Re: Calling a machine code/binary function given its address, return type, & parameter types James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-08-21 09:05 -0400

csiph-web