473,324 Members | 2,248 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,324 software developers and data experts.

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 2450
Ajinkya <ka*********@gmail.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...@gmail.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*********@gmail.comwrites:
On Sep 28, 12:27 pm, Ben Bacarisse <ben.use...@bsb.me.ukwrote:
>Ajinkya <kaleajin...@gmail.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(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.
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*********@gmail.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
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...
2
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...
0
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...
3
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...
5
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...
0
by: Pascal Costanza | last post by:
Dynamic Languages Day @ Vrije Universiteit Brussel ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Monday, February 13, 2006, VUB Campus Etterbeek The VUB (Programming Technology Lab,...
11
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...
1
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....
1
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

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.