hi there,

I just made a Dynamic-link library(simple.dll(simple.lib also)) with
Visual C++6.
What the library's function( int my_function(int,int)) does is just to
add 2 numbers and return the result;

I'm trying to make Perl inline C code call my DLL.

Here are my codes.
----------------[my_perl.pl] ---------------------------

use Inline C => DATA =>
           LIBS => '-lsimple';

__END__
__C__

#include "myheader.h"

int add(int a, int b) {
    return my_function(a,b);
}
-----------------------------------------------------

----------------[myheader.h]-------------------------
extern "C"{
int my_function(int,int);
}
-----------------------------------------------------

----------------[simple.cpp]---------------------------

int my_function(int a, int b){
   return( a+b );
}

-----------------------------------------------------
myheader.h & simple.c is compiled to simple.dll & simple.lib 

When I try "perl my_perl.pl" on DOS-prompt, I get errors below.
------------------------------------------------------------------------
Microsoft (R) Program Maintenance Utility   Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

NMAKE : fatal error U1073: don't know how to make '2' 
Stop.

Microsoft (R) Program Maintenance Utility   Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

NMAKE : fatal error U1077: 'C:\PROGRA~1\MICROS~3\VC98\BIN\cl.exe' : return code '0
x2'
Stop.
Had problems bootstrapping Inline module main_C_my_perl_pl_5e9a688735c4a976ec136
25177c77ee0
Can't locate loadable object for module main_C_my_perl_pl_5e9a688735c4a976ec1362
5177c77ee0 in @INC (@INC contains: C:/test_perl/_Inline/lib C:/Perl/l
ib C:/Perl/site/lib .) at C:/Perl/lib/DynaLoader.pm line 112
        DynaLoader::croak('Can\'t locate loadable object for module main_C_my_pe
rl_pl_5e9a6...') called at C:/Perl/lib/DynaLoader.pm line 180
        DynaLoader::bootstrap('main_C_my_perl_pl_5e9a688735c4a976ec13625177c77ee
0') called at (eval 25) line 6
        eval '  package main;
        push @main::ISA, qw(main_C_my_perl_pl_5e9a688735c4a976ec13625177c77ee0


        package main_C_my_perl_pl_5e9a688735c4a976ec13625177c77ee0;
        push @main_C_my_perl_pl_5e9a688735c4a976ec13625177c77ee0::ISA, qw(Expo
er DynaLoader);
        bootstrap main_C_my_perl_pl_5e9a688735c4a976ec13625177c77ee0;

;' called at C:/Perl/site/lib/Inline.pm line 541
        Inline::load('Inline::C=HASH(0x1c8fe28)') called at C:/Perl/site/lib/I
ine.pm line 225
        Inline::glue('Inline::C=HASH(0x1c8fe28)') called at C:/Perl/site/lib/I
ine.pm line 170
        Inline::init called at (eval 1) line 4
        Inline::INIT() called at (eval 25) line 0
        eval {...} called at (eval 25) line 0

INIT failed--call queue aborted.
--------------------------------------------------------------------------------

I'm sure that simple.lib is in the Library Path.


and I wanna know that there're any requirements to make DLL which can be
called from Perl Inline C ? Such as I must have (.def) file in DLL.
If so, which type should I use for functions which will be exported ?
__ccdec(?) or __stdcall ?


Thank you.
tony

ps)
I've been checking this mail archive and found one mail.
http://www.mail-archive.com/[email protected]/msg00102.html
I guess the problem(long file name) in the mail and mine is pretty same.

because If I code perl with simple Inline C (doesn't call DLL), It
generates DLL named 
main_C_tp4_pl_137f2fc3acc31fdac437097cf1958281.dll

but I just got the Inline::C with PPM (in Dos-console) yesterday, so I
don't think my Inline module is old.

Just make sure, I checked when the module was made...
C:\Perl\site\lib\Inline\C.pm  01/01/17 9:24
C:\Perl\site\lib\Inline\C.pod 01/01/19 1:14
hm....seems old.  Over 1 year has been already passed...

How I got Inline::C is, I just typed below in PPM in DOS-Console
PPM>install Inline::C
PPM>........ [y/N] y (return)
....
PPM>........ [y/N] y (return)
PPM>....
I answered y to all questions like "install Inline ?"..

Thank you very much for reading till here...





Reply via email to