Looks like a typical problem in embedding perl modules which themselves use C libraries.
Here is the solution
http://perldoc.perl.org/perlembed.html#Using-Perl-modules%2c-which-themselves-use-C-libraries%2c-from-your-C-program
- Karthic
CPAN::Forum
Spreadsheet-WriteExcel - Re: Dynamice Loading of Perl