473,725 Members | 2,212 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamic includes/linking

I have writen a program for a game called game.exe
Now it includes a player part to which has to be a function to be
writen by someone else.

Now I want to provide this exe to some tester who will be writing his
player function.

I dont know his file name and his function name....he will have to
include it.
I am providing him the game.exe and a common file containing all the
includes(which is in turn included in my code)
He will have to include his file through this common includes file.

But as includes are compile time even after changes in the common
includes file doesnot change the exe behaviour.

I want to dynamically include his file/code at runtime/dynamic through
the common includes file...

How can i go about regarding this problem ?

Thanks,
Ajinkya

Sep 28 '07 #1
7 2477
Ajinkya <ka*********@gm ail.comwrites:
I have writen a program for a game called game.exe
Now it includes a player part to which has to be a function to be
writen by someone else.

Now I want to provide this exe to some tester who will be writing his
player function.

I dont know his file name and his function name....he will have to
include it.
I am providing him the game.exe and a common file containing all the
includes(which is in turn included in my code)
He will have to include his file through this common includes file.

But as includes are compile time even after changes in the common
includes file doesnot change the exe behaviour.

I want to dynamically include his file/code at runtime/dynamic through
the common includes file...

How can i go about regarding this problem ?
The facilities provided by standard C (the topic in this group) in the
respect are rather limited (you can try to run a program, but not much
more). You'll get more helpful answers in a group that discusses the
facilities of your system. The .exe suggests you want a Windows
programming group.

--
Ben.
Sep 28 '07 #2
On Sep 28, 12:27 pm, Ben Bacarisse <ben.use...@bsb .me.ukwrote:
Ajinkya <kaleajin...@gm ail.comwrites:
I have writen a program for a game called game.exe
Now it includes a player part to which has to be a function to be
writen by someone else.
Now I want to provide this exe to some tester who will be writing his
player function.
I dont know his file name and his function name....he will have to
include it.
I am providing him the game.exe and a common file containing all the
includes(which is in turn included in my code)
He will have to include his file through this common includes file.
But as includes are compile time even after changes in the common
includes file doesnot change the exe behaviour.
I want to dynamically include his file/code at runtime/dynamic through
the common includes file...
How can i go about regarding this problem ?

The facilities provided by standard C (the topic in this group) in the
respect are rather limited (you can try to run a program, but not much
more). You'll get more helpful answers in a group that discusses the
facilities of your system. The .exe suggests you want a Windows
programming group.
Exactly...cause in unix there is a method i have found but it is
platform dependent way.
I want this to work in windows....is this anything related to dll ? I
know rather nothing of dll but heard of it...just a guess...
>
--
Ben.- Hide quoted text -

- Show quoted text -

Sep 28 '07 #3
Ajinkya <ka*********@gm ail.comwrites:
On Sep 28, 12:27 pm, Ben Bacarisse <ben.use...@bsb .me.ukwrote:
>Ajinkya <kaleajin...@gm ail.comwrites:
I have writen a program for a game called game.exe
Now it includes a player part to which has to be a function to be
writen by someone else.
Now I want to provide this exe to some tester who will be writing his
player function.
<snip>
I want to dynamically include his file/code at runtime/dynamic through
the common includes file...
How can i go about regarding this problem ?

The facilities provided by standard C (the topic in this group) in the
respect are rather limited
<snip>
> The .exe suggests you want a Windows programming group.
Exactly...cause in unix there is a method i have found but it is
platform dependent way.
I want this to work in windows....is this anything related to dll ? I
know rather nothing of dll but heard of it...just a guess...
No, there is nothing in standard C about DLLs.

If you need a portable solution, maybe you can do it by linking (or
even compiling) the "guest" code?

If you need some more info about DLLs, post in a Windows programming group.

PS. Don't quote sigs (the bit after the "-- ").
PPS. Try to trim the message you reply to.

--
Ben.
Sep 28 '07 #4
>I have writen a program for a game called game.exe
>Now it includes a player part to which has to be a function to be
writen by someone else.

Now I want to provide this exe to some tester who will be writing his
player function.

I dont know his file name and his function name....he will have to
include it.
You might be able to use dynamic linking to link to a "plugin".
However, this is not a part of standard C and will require
system-specific features, if they are available. You may be able
to accept the file name of the plugin as, say, a command-line
argument.

There is no "dynamic include".
>I am providing him the game.exe and a common file containing all the
includes(whi ch is in turn included in my code)
He will have to include his file through this common includes file.
>But as includes are compile time even after changes in the common
includes file doesnot change the exe behaviour.
Even for a plugin, changes in common includes require re-compilation
of all the pieces that use them. It is best to find an interface for
the plugin and not change it much.
>I want to dynamically include his file/code at runtime/dynamic through
the common includes file...
Plugins are usually done by separate compilation, not by including
a whole bunch of files in one big compilation. Changing the code
in the plugin requires recompilation of the plugin only.

Sep 28 '07 #5


Can you give me an example how this can be done ?
I didnt get exactly what do you mean by a plugin..
Can you give a small example of the design you are suggesting ?

Sep 29 '07 #6
>Can you give me an example how this can be done ?

There's no standard way to do this; it's all system-specific.
>I didnt get exactly what do you mean by a plugin..
In some implementations , you can call a function dlopen(), which
takes a file path name as an argument, to load a shared object
(plugin). This object is compiled and linked separately from the
main executable. You may then call dlsym() or dlfunc() with the
name of a symbol to get a function pointer to the function named,
and use that pointer call the function.

This is different from a "normal" shared library use, where no
special calls are required by the program to use the library because
it's all set up before the program starts running using the libraries
specified to the linker.
>Can you give a small example of the design you are suggesting ?
Apache (the web server program) as implemented on FreeBSD (and
presumably other BSD Unix variants and Linux) uses a number of
plugins which can be specified in a configuration file at runtime.

Although a lot of the details may be different, Windows *.dll files
can be used in a similar way.

Sep 29 '07 #7
On Sat, 29 Sep 2007 03:32:17 -0000, in comp.lang.c , Ajinkya
<ka*********@gm ail.comwrote:
>

Can you give me an example how this can be done ?
There's no standard way - you would need to ask the specialists in a
group which is dedicated to your operating system and/or compiler.
>I didnt get exactly what do you mean by a plugin..
Can you give a small example of the design you are suggesting ?
http://en.wikipedia.org/wiki/Plugin

--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Sep 29 '07 #8

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

Similar topics

1
2589
by: Jeff Hagelberg | last post by:
I'm trying to create a python module which can be used by a python interpreter embedded inside a fortran program I have. To do this, I first created python wrappers for all the functions in my fortran program using f2py. I then start an embedded python interpreter in c code which I link against the fortran program. I invoke the fortran program with a filename containing python code. This file is passed to the c code which passes it on...
2
2246
by: jason | last post by:
Will this work - dynamic determination of root (local or web host) and consume this in include file anywhere. I am concerned about dynamic construction of virtual absolute include in the consuming file. Take a look and tell me what you think: GLOBAL.ASA Sub application_onstart
0
2345
by: Dibyendu Roy | last post by:
Hi All, I build an object called "dblorcle" to connect to oracle database in Sun solaris box. This is built linking with various oracle ".a" (archived, for static linking) files come with standard oracle library. I use the following command while linking: ld -L(oracle lib path) -lnetv2 -lnttcp -lnetwork -lncr -lnetv2 -lnttcp -lnetwork -lclient -lcommon -lgeneric -lmm -lnlsrtl3 -lcore4 For each element starting with -l has...
3
4268
by: K.S.Liang | last post by:
Hi all, 1> If there are more than one dynamic linking libraries in the file system, how do I know which one is loaded into system? Any C library or system call can tell me which *.so or *.sl is active? Can the setting of LD_LIBRARY_PATH guanrantee that the correct one is executed? 2> In MS-WINDOWS, once a DLL is loaded by one allication, this DLL will be used by the subsequent appication. Does UNIX have the same
5
1688
by: Sam Steingold | last post by:
I have a main program and an add-on module that uses some functionality in the main program. E.g., the main program main.c has function foo(). The add-on module in file addon.c calls foo(). I want to compile addon.c into libaddon.so (aka addon.dll) so that it can later be loaded into a running main program if necessary. When I try to do that, I get this error: $ gcc -fPIC -Wl,-export-dynamic -shared -o addon.dll addon.o
0
2072
by: Pascal Costanza | last post by:
Dynamic Languages Day @ Vrije Universiteit Brussel ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Monday, February 13, 2006, VUB Campus Etterbeek The VUB (Programming Technology Lab, System and Software Engineering Lab), ULB (deComp) and the Belgian Association for Dynamic Languages (BADL) are very pleased to invite you to a whole day of presentations about the programming languages Self, Smalltalk and Common Lisp by experts in...
11
2078
by: Sean M. DonCarlos | last post by:
I have an unmanaged Win32 app that looks up the name of a DLL (unknown at compile time) from an external location, loads it with LoadLibrary, and then uses GetProcAddress on three exported functions (whose names and signatures are known at compile time). The app then calls these functions as needed throughout its execution. Depending on circumstances, there may be zero, one, or many separate DLLs loaded that all conform to this pattern...
1
4289
by: zpinhead | last post by:
I am unable to get my downloaded extension from pecl to link up with php properly. seems like the php.so I could not use pear install http. pear claimed the extension was already installed. that is certainly not true. I downloaded the http extension from pecl. cvs -d:pserver:cvsread@cvs.php.net:/repository co pecl/http
1
5960
by: srikar | last post by:
what is the difference between static linking & dynamic linking, what are the advantages of each? How to perform static linking & Dynamic linking by using gcc -o liniking will be done , but how can we control the type of linking Hi any one please help me to clarify my doubt
0
8888
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9113
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8097
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3221
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2635
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.