force another file to define a function


Lets say I have 3 seperate files called: <strong>main.c</strong>, <strong>test.c</strong> and <strong>test.h</strong>. How could I "force" a function that includes <strong>test.h</strong> to define a function which is already declared in <strong>test.h</strong>, that <strong>test.c</strong> file can call it.

This ia a bit messy, so let me give you some code samples of what I mean.


... #define SOMETHING ... #ifdef SOMETHING inline void test_func(BYTE b); #endif ...


#include "test.h" void somefunction(void) { ... #ifdef SOMETHING test_func(integer_value); #endif ... }


#include "test.h" int main(void) { ... } inline void test_func(BYTE b) { // Do something with b }

In short: <strong>test.h</strong> declared a function, <strong>main.c</strong> defines that function and <strong>test.c</strong> calls that function.

Is this possible? How?


The user declares the function in <strong>main.c</strong> when to compiler gives a error or something that that function is not declared.


In short it should be possible to do this. Why ? The file implementing a function does not have to be in a header file with the same name. The linker will resolve any issues if any and complain if something is missing. If the compiler complains, then there is a missing header file or your header file function definition does not match with what you have in the c file.


  • How does UserPassesTestMixin in django work?
  • Achieve window function InterlockedExchange in Linux
  • Is it possible to use multiprocessing.Event to implement a synchronization barrier for pool of proce
  • Boost:Serialization: Who cleans up the deserialized data?
  • including a c/c++ header file in fortran subroutines
  • How to store pointer to S3 objects in Amazon SimpleDB?
  • Dojox/mvc/at model scope
  • How to parse the geolocation json from google for lng and lat in objective-c
  • WPF auto resize elements
  • Imagemagick set interline spacing?
  • iPhone dealing with xml vs soap vs JSON vs RESTful
  • Finding number of samples in a .wav header
  • Django: DRY principle and UserPassesTestMixin
  • C++ accessing vector
  • Is mp4 stream able with ffserver?
  • Mongodb update() vs. findAndModify() performace
  • Rodeo UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 0: ordinal
  • Getting NullPointer exception with File.listfiles()
  • Convert Type Decimal to Hex (string) in .NET 3.5
  • copying resource to sdcard gives a damaged file in android
  • Allowing both email and username for authentication
  • Get one-time binding to work for ng-if
  • Linq Objects Group By & Sum
  • Optimizing database types to compact database (SQLite)
  • How do you troubleshoot character encoding problems?
  • Buffer size for converting unsigned long to string
  • Acquiring multiple attributes from .xml file in c#
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Change div Background jquery
  • How does Linux kernel interrupt the application?
  • How can I remove ASP.NET Designer.cs files?
  • EntityFramework adding new object to nested object collection
  • Checking variable from a different class in C#
  • Django query for large number of relationships
  • Busy indicator not showing up in wpf window [duplicate]
  • reshape alternating columns in less time and using less memory
  • failed to connect to specific WiFi in android programmatically
  • Why do underscore prefixed variables exist?
  • java string with new operator and a literal
  • How can I use threading to 'tick' a timer to be accessed by other threads?