Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Need help in creating a .dll/.so from .obj files?  (Read 2336 times)

0 Members and 1 Guest are viewing this topic.

magneonx

  • Full Member
  • ***
  • Posts: 141
    • MSN Messenger - magnumneon04@hotmail.com
    • View Profile
Need help in creating a .dll/.so from .obj files?
« on: March 02, 2015, 09:07:55 am »
I don't want to do a long post on my question. I already done my research on how C++ compiles the code we write and after compilation phase, it gives .obj files which is passed to the linker to become an executable (i.e. .exe) or a shared library (.dll/.so). Now having this knowledge, I wanted to create a simple .cpp and .hpp file, get the .obj for this files and generate the .lib or .so for this project. I want it not tied to any platform, compiler, or IDE, unless it really can't be helped. Is this a complicated process that needs heavy study and research?

I also found out Cmake files used to generate project templates so it can be loaded to an IDE. It generates the library file (both static and dynamic) appropriate with the IDE, Compiler and the Platform I am using (.dll for Windows) which I used to develop games with. But I don't know how to do similarly for my project.

I hope you can enlighten me with steps after having .obj files and turning this into .dll/.so. Do I need a specific configuration that tells my whatever IDE or compiler that they are building a library not binary? Such that when I press the compile button on whatever IDE it produces the .lib/.so on the bin folder. I have seen library templates on both CodeBlocks and VSE, but I think this will not help me achieve what I wanted to do by tying my code to the IDE and Compiler I am using.

I hope you could provide me insights and enlightenment on this topic. Also, please correct me if I got the wrong perspective. Thank you.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: Need help in creating a .dll/.so from .obj files?
« Reply #1 on: March 02, 2015, 09:19:58 am »
This is the SFML forum. If you general C++ questions you'll most likely get better answers on dedicated communities such as StackOverflow.

Object files and library files are compiler and thus platform specific as such there's no "general" way to go about it. If you really want something more "universal" you might want to use LLVM.

In general you're better off using a build system like CMake which generates compiler and platform specific make or project files.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Need help in creating a .dll/.so from .obj files?
« Reply #2 on: March 02, 2015, 06:09:55 pm »
The simplest cross platform/compiler way I know of is SCons.