[cfe-dev] Creating DLLs from within an application

Marco Craveiro marco.craveiro at gmail.com
Mon Dec 10 08:40:23 PST 2012


Hello cfe-dev,

I'm investigating dynamic code generation and Clang seems to be the
perfect fit. I couldn't find an answer in Google - but maybe its just
my Google-fu. Anyway, my scenario is this: I'd like to create a
program that generates several .c files with trivial C functions.
These rely on no includes - only arithmetic operations on arrays of
doubles. I'd like to package up all these functions into a DLL/SO,
load it and call the functions from within the running application.
The parameters being passed in will be the arrays to doubles that
would have already been loaded into memory by the main program.

I just wanted to double-check with the mailing list that all of the
above can be done by linking at compile time against a clang library
(static or dynamic); my program would generate the  .c files and the
clang infrastructure would do the magic to come up with the DLL/SO.
I'm fairly confident with the rest - traditional DLL/SO loading and
unloading - unless some one foresees any problems.

Many thanks for your time, and for a great compiler and surrounding
infrastructure.

Cheers

Marco
-- 
So young, and already so unknown -- Pauli

blog: http://mcraveiro.blogspot.com



More information about the cfe-dev mailing list