x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Compiling c files with the Unreal Build System

Hi, I have an external lib that I would like to include as source in a plugin I'm making. The lib is written in straight c and I had a few issues getting the Unreal Build System to compile the module that I'm reporting here as potential bug reports or for people to find via search:

1) the MODULENAME_API macro does not seem to work with c files (it does not seem to replace the export / import correctly).

2) because of this you need to wrap exposed functionality in a cpp file to expose something or the .exp file will not be produced and the module compilation will fail

hope this helps someone!

Product Version: UE 4.16
Tags:
more ▼

asked Jul 18 '17 at 11:30 AM in Bug Reports

avatar image

Structure
3 2 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hi Structure,

Sorry for not responding to your post sooner. Are you still having trouble with this?

The MODULENAME_API macro should work for both C and C++. However, since our module system was created using C++, the macro was never really intended to link to a C library.

What is most likely happening here is that your C library is being correctly included as a dependency, so the macro is set to import. However, because it is a C library, our build system never actually builds the library and the macro is never set to export. That is probably why wrapping your library's functionality with C++ and using the macro there works fine.

Tim

more ▼

answered Feb 28 '18 at 07:09 PM

avatar image Structure Mar 26 '18 at 11:20 AM

Hi Tim, thanks for the reply. Our C++ wrapper is doing what we need for now. But maybe this something to put into the backlog to make a test case out of compiling a straight c lib in the future.

Thanks!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question