how to use standard c header files in arduino

I have a simple C library that looks like this:

//mycLib.h
#ifndef _MY_C_LIB_h
#define _MY_C_LIB_h                   
    typedef struct {char data1;
                    int data2;
                    } sampleStruct;             

    extern void mycLibInit(int importantParam);
    extern void mycLibDoStuff(char anotherParam);

    extern void sampleStruct mycLibGetStuff();
#endif
//mycLib.c
sampleStruct _sample;
void mycLibInit(int importantParam)
{
    //init stuff!
    //lets say _sample.data2 = importantParam
}

void mycLibDoStuff(char anotherParam)
{
    //do stuff!
    //lets say _sample.data1 = anotherParam
}

sampleStruct mycLibGetStuff()
{
    //return stuff, 
    // lets say return _sample;
}

It works well when called from other test software. However, as part of another project, I have to include it in an Arduino project and compile it to work on Arduino Uno as well. Unfortunately, When I run my Arduino code that looks like this:

#include <mycLib.h>

void setup()
{
  mycLibInit(0);
}

void loop()
{
}

I get the following compile error:

code.cpp.o: In function setup': C:\Program Files (x86)\Arduino/code.ino:6: undefined reference tomycLibInit(int)'

I have read following threads:

but in all those cases the external library was in form of a c++ class with a constructor call in the Arduino code.

Is there a way to tell Arduino IDE that "hey this function is part of this C library" or, should I re-write my functionality into c++ classes? Its not my favorite solution because the same c-Module is being used in other projects. (I know I probably can use preprocessor directives to have the code in the same place but it is not a pretty solution!)

//mycLib.h
#ifndef _MY_C_LIB_h
#define _MY_C_LIB_h                   

#ifdef __cplusplus
extern "C"{
#endif

    typedef struct {char data1;
                    int data2;
                    } sampleStruct;             

    extern void mycLibInit(int importantParam);
    extern void mycLibDoStuff(char anotherParam);

    extern void sampleStruct mycLibGetStuff();

#ifdef __cplusplus
} // extern "C"
#endif

#endif

Thanks Coding Badly!

Before I see your reply or try it, I rewrote my module in CPP. It works fine in test software in visual studio, however, when included and compiled in ARduino it just does not work!

I dont get any compile errors, it compiles, gets uploaded to the board but simply does nothing! This is an issue that I have to track tomorrow... But

But about your answer, now I have another question, then how would you call public functions of this .h file from Arduino code? Can you please give me an example?

All I have seen is that ppl call a constructor from a class in their c library and then call their methods from it. would be current arduino work with it? Should I put the mylib.h and .c in Arduino Libraries folder or should I put them next to my arduino code file? maybe just using the c in the way you mentioned help me!

Thanks,
fetah

You are welcome.

fetah:
But about your answer, now I have another question, then how would you call public functions of this .h file from Arduino code?

Just like in your original post.

would be current arduino work with it?

Yes.

Should I put the mylib.h and .c in Arduino Libraries folder or should I put them next to my arduino code file?

With a test sketch until the code is debugged then as a library.