473,383 Members | 1,762 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

linking executables

Hi all,

I bet this question has been asked a thousand times.
Is it in any way possible to link to an executable.

Platform: Linux

What would like to do:

I have a binary, say mybin, I don't have the sources.

I would like to dlopen it and execute the main() function.
Is this, or a workaround possible.
I don't want to "exec()"-it in a forked process.

I bet this must sound like blasphemy ;-)

Regards,
Evert

Nov 14 '05 #1
2 1390
Evert Carton <me@you.he> spoke thus:
I bet this question has been asked a thousand times.
Is it in any way possible to link to an executable. I would like to dlopen it and execute the main() function.
Is this, or a workaround possible.
I don't want to "exec()"-it in a forked process. I bet this must sound like blasphemy ;-)


Actually, it sounds like you should have posted this question
elsewhere.

http://www.ungerhu.com/jxh/clc.welcome.txt
http://www.eskimo.com/~scs/C-faq/top.html
http://benpfaff.org/writings/clc/off-topic.html

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Nov 14 '05 #2
Evert Carton wrote:
I bet this question has been asked a thousand times.
Is it in any way possible to link to an executable.

Platform: Linux
I'll assume that means that you are using the GNU C compiler.
What would like to do:

I have a binary, say mybin, I don't have the sources.

I would like to dlopen it and execute the main() function.
Is this, or a workaround possible.
I don't want to "exec()"-it in a forked process.
man system
SYSTEM(3) Linux Programmer’s Manual
SYSTEM(3)

NAME
system - execute a shell command

SYNOPSIS
#include <stdlib.h>

int system(const char *string);

DESCRIPTION
system() executes a command specified in string
by calling /bin/sh -c string, and returns
after the command has been completed.
During execution of the command, SIGCHLD will be blocked,
and SIGINT and SIGQUIT will be ignored.
I bet this must sound like blasphemy ;-)


You might try asking this question in the gnu.gcc.help newsgroup.

Nov 14 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
by: Lee Phillips | last post by:
I believe it is universally accepted that decorating your website with images from someone else's, without permission, is rude and unethical, even if the images are in the public domain, because...
7
by: Paul Kirby | last post by:
Hello All I am writing an application and a dll file and I was wondering how I would access functions within the exe file from the dll? Example: /* EXE File */ long GetUserCount(void) {
2
by: gurpreet | last post by:
Hi this is gurpreet, I know this is a very simple question but still I want to clear some doubts. What happens when we compile and link a c-program? I hope aquite a lot of responses to my...
3
by: Eric W | last post by:
MS VC++ 7.1 - I have a project with static libs A, B and C where A depends on B anc C, also B depends on C. If I set this up in the project dependency dialog for A the Build environment puts B...
1
by: Water Cooler v2 | last post by:
I have a Windows Service I am writing in C# and a set of, let us say three, other executables written in C# (mostly console applications). I want that the Windows Service must do so every few...
1
by: sirchia.r | last post by:
Hi all, I'm not very much of a C expert, so I hope one of you is willing to help me out. What I'm trying to do is create a shared object library SO1, to which an executable E is already...
3
by: Sami Lakka | last post by:
I have a solution with a two projects. The first project contains my classes and an executable using those classes. The second project contains unit tests for the classes. Because the unit test...
3
by: Randy Yates | last post by:
Hi Folks, I have a cross-development problem in which I'm using the x86_64 version of Fedora Core 6 as a development system but want to build executables that are 32-bit. I've got a mix of C...
3
by: =?Utf-8?B?TWlrZSBE?= | last post by:
I want to place a link on my Intranet that points to a shortcut on the client workstation. So far I have not been able to phrase the question well enough to get any good responses. I saw it on...
2
by: jitender001001 | last post by:
hi all I have a problem of linking static libraries with GC_MALLOC, I have made my routine smaller to make it simpler. I m using fedora 7 kernel version 2.6.18-1.2798.fc6 void str_check_alloc(...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.