-2

I have a C ++ project that when compiled turns into a dll. Is it possible for me to compile the same code and generate a static lib?

If possible, would I have to change a lot of the code structure?

Simon Kraemer
  • 5,700
  • 1
  • 19
  • 49
mgratao
  • 3
  • 4
  • 2
    What, for you, is the difference between a dll and a lib? – Yunnosch Oct 01 '20 at 12:53
  • 2
    What is a "font" in this context? – Yunnosch Oct 01 '20 at 12:54
  • 1
    How exactly do you built into a dll? Do you have a makefile? A project configuration? A commandline? – Yunnosch Oct 01 '20 at 12:55
  • When I speak source, I mean the code. The c ++ dll is being compiled in Visual Studio 2010 – mgratao Oct 01 '20 at 12:59
  • 1
    Um, was that meant to answer any of my comments? – Yunnosch Oct 01 '20 at 13:00
  • I don't find a guide for that old Visual Studio version but [here's one for VS2015](https://learn.microsoft.com/en-us/cpp/build/walkthrough-creating-and-using-a-static-library-cpp?view=vs-2015) - What does `wininet` and `delphi` have to do with anything in this question? – Ted Lyngmo Oct 01 '20 at 13:02
  • 1
    Currently it is unclear what you mean with the terms `font` and `lib` and what the actual problem is. Also you did tag `delphi` but never mention it anywhere in your question. Please provide more information on what problem you are trying to solve and please be as specific as possible. – Simon Kraemer Oct 01 '20 at 13:03
  • I don't see what is unclear about this question ! – engf-010 Oct 01 '20 at 13:26
  • @engf-010 "lib" is not necessarily a term I would directly associate with a static library but as an abbreviation to "library" in general, contrary to "dll" that refers to a shared library. So the first part of the question is not phrased exactly - but that's nitpicking. The real issue comes from the fact that OP wrote `font` where it should read `code` and that the question was tagged with `delphi` and `wininet`. I suggest you check the edit history. – Simon Kraemer Oct 02 '20 at 12:24
  • @simon kramer: don't need to see the edit-history ,followed this question from the start. True, the (original) text was mostly irrelevant ,but the questions are very clear and simple (as is the answer) even if of low quality. – engf-010 Oct 02 '20 at 12:43

1 Answers1

1

Is it possible to generate a lib through the code of a dll? Yes.

Would I have to change a lot of the code structure? If done right : not really.

Your dll-header(s) probably makes the distiction for importing and exporting declarations/definitions. You need to make a third distinction for non-dll usage (no importing exporting).

The biggest change would probably involve separating your projects structure.

engf-010
  • 3,980
  • 1
  • 14
  • 25