Hi All Has anyone tried calling an exported function from C DLL in a Perl Pro +gram. I have a C DLL's source file and its header file and using h2xs to call its exported function from a Perl program. >D:\DLLProjects\simpledll3>h2xs -n ext2 simpledll3.h >Writing ext2/ext2.pm >Writing ext2/ext2.xs >Writing ext2/Makefile.PL >Writing ext2/README >Writing ext2/test.pl >Writing ext2/Changes >Writing ext2/MANIFEST >D:\DLLProjects\simpledll3>cd ext2 >D:\DLLProjects\simpledll3\ext2>perl makefile.pl Checking if your kit is complete... Looks good Writing Makefile for ext2 >D:\DLLProjects\simpledll3\ext2>nmake Microsoft (R) Program Maintenance Utility Version 1.50 Copyright (c) Microsoft Corp 1988-94. All rights reserved. C:\Perl\bin\perl.exe -Ic:\Perl\lib -Ic:\Perl\lib C:\Perl\lib\ExtUtils/xsubpp -typemap C:\Perl\lib\ExtUtils\typemap ext +2.xs > ext2.xsc && C:\Perl\bin\perl.exe -Ic:\Perl\lib -Ic:\Perl\lib -MExtUtils::Command - +e mv ext2.xsc ext2.c cl -c -nologo -O1 -MD -Zi -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_ +SYS -DPERL_MSVCRT_READFIX - O1 -MD -Zi -DNDEBUG -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" -IC:\Perl\lib\CORE ext2.c ext2.c cl -c -nologo -O1 -MD -Zi -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAV E_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DPERL_MSVCRT_READFIX - O1 -MD -Zi -DNDEBUG -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" -IC:\Perl\lib\ CORE simpledll3.cpp simpledll3.cpp "Running Mkbootstrap for ext2 ()" C:\Perl\bin\perl.exe -Ic:\Perl\lib -Ic:\Perl\lib -MExtUtils::Command -e chmod 644 ext2.bs link -out:blib\arch\auto\ext2\ext2.dll -dll -nologo -nodefaultlib -debug -opt:ref,icf -libpath:"c:\Perl\lib\CORE" -machine:x86 ext2.obj simpledll3.obj C:\Perl\lib\CORE\perl56.lib "C:\Program Files\Microsoft Visual Stud +io\VC98\Lib\oldnames.lib" "C:\Program Files\Microsoft Visual Studio\V +C98\Lib\kernel32.lib" "C:\Program Files\Microsoft Visual Studio\VC98\Lib\user32.lib" "C:\Program Files\Microsoft Visual Studio\VC98\Lib\gdi32.lib" "C:\Prog +ram Files\Microsoft Visual Studio\VC98\Lib\winspool.lib" "C:\Program Files\Microsoft Visual Stud +io\VC98\Lib\comdlg32.lib" "C:\Program Files\Microsoft Visual Studio\V +C98\Lib\advapi32.lib " "C:\Program Files\Microsoft Visual Studio\VC98\Lib\shell32.lib" "C:\Program Files\Microsoft Visual Studio\VC98\Lib\ole32.lib" "C:\Prog +ram Files\Microsoft Visual Studio\VC98\Lib\oleaut32.lib" "C:\Program +Files\Microsoft Visual Studio\VC98\Lib\netapi32.lib" "C:\Program File +s\Microsoft Visual Studio\VC98\Lib\uuid.lib" " C:\Program Files\Microsoft Visual Studio\VC98\Lib\wsock32.lib" "C:\Program Files\Microsoft Visual Studio\VC98\Lib\mpr.lib" "C:\Progra +m Files\Microsoft Visual St >udio\VC98\Lib\winmm.lib" "C:\Program Files\Microsoft Visual Studio\V +C98\Lib\version.lib" "C:\Program Files\Microsoft Visual Studio\VC98\Lib\odbc32.lib" "C:\Program Files\Microsoft Visual Studio\ +VC98\Lib\odbccp32.lib" "C:\Program Files\Microsoft Visual Studio\VC98\Lib\msvcrt.lib" -def:ex +t2.def Creating library blib\arch\auto\ext2\ext2.lib and object blib\arch\auto\ext2\ ext2.exp ext2.obj : error LNK2001: unresolved external symbol _num blib\arch\auto\ext2\ext2.dll : fatal error LNK1120: 1 unresolved exter +nals NMAKE : fatal error U1077: 'C:\WINNT\system32\cmd.exe' : return code ' +0x460' Stop. where num is the exported method which I have written in the file Simp +leDLL3.cpp int _stdcall num(int x) { return x+1; } I have written the XSUB in ext2.xs file as shown below: int num(x) int x Why does it give an error for _num or for that matter any exported fun +ction name. Any help would be greatly appreciated. Thanks, Sam.

In reply to win32 DLL from h2xs returns error by sam01102005

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.