0

I have two source files that contain routines I want in my .dll. I can build the .dll, but I have to do something like this:

#include <stdio.h>
#include "routines1.h"
#include "routines2.h"
#include "routines1.c"
#include "routines2.c"

This works, but it is very ugly and I am sure it must be wrong. I am more familiar with building libraries in Linux wherein adding files together is less problematic. I am working in C.

Jiminion
  • 5,080
  • 1
  • 31
  • 54
  • Are you using an IDE (like Visual Studio or similar)? Then add the files as source files like any other source file in your project. – Some programmer dude Aug 09 '17 at 13:06
  • I tried that, but with no references to the functions, the resulting .dll is just empty. – Jiminion Aug 09 '17 at 13:27
  • Do you *export* the functions that the API in the DLL provides? Perhaps you should read a few tutorials about creating a DLL first? – Some programmer dude Aug 09 '17 at 13:28
  • OK, that seems to work (using __declspec( dllimport ) ). (Not many tutorials using C. – Jiminion Aug 09 '17 at 14:49
  • 1
    See https://stackoverflow.com/questions/39358641 for a discussion of __declspec(dllimport) and __declspec(dllexport). Classes or functions, c++ or c, the directive works the just the same. – stanthomas Aug 09 '17 at 15:19

0 Answers0