Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

camlidl: bulding native code DLLs with camlidldll script #2878

Closed
vicuna opened this issue Jul 31, 2001 · 1 comment
Closed

camlidl: bulding native code DLLs with camlidldll script #2878

vicuna opened this issue Jul 31, 2001 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Jul 31, 2001

Original bug ID: 466
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: -for CamlIDL use https://github.com/xavierleroy/camlidl/issues

Bug description

Here is the patch for camlidldll script which allows bulding both byte code
and native DLLs. Native mode is activated with "-opt" option:

camlidldll -opt ....

-linkobjs option is also introduced for native mode, specifing non-caml
.obj files which we need to link. .obj files without this option are passed
to ocamlopt when creating output-obj file.

[---cut---]
Index: camlidldll.tpl

RCS file: /caml/bazar-ocaml/camlidl/tools/camlidldll.tpl,v
retrieving revision 1.4
diff -u -r1.4 camlidldll.tpl
--- camlidldll.tpl 2000/08/21 12:55:02 1.4
+++ camlidldll.tpl 2001/07/31 18:07:12
@@ -28,37 +28,51 @@
resfile=''
tlbcounter=0

+camlobjs_mask=".cm[oa]"
+linkobjs_mask="
.lib|*.obj"
+ocamlc="ocamlc -custom"
+com_lib="com.cma"
+camlruntime_lib="libcamlrun.lib"
+
rm -f $resourcefile

Parse the command line

while : ; do

  • case "$1" in
  • "") break;;
  • eval "case "$1" in
  • "") break;;

my options

  • -opt)
  •   camlobjs_mask=\"*.obj|*.cmx|*.cmxa\"
    
  •   linkobjs_mask=\"*.lib\"
    
  •   ocamlc=\"ocamlopt\"
    
  •   com_lib=\"com.cmxa\"
    
  •   camlruntime_lib=\"libasmrun.lib\";;
    
    -o) output=$2; shift;;
    -linkopt)
  •    linkopts="$linkopts $2"; shift;;
    
  •    linkopts=\"$linkopts $2\"; shift;;
    
  • -linkobjs)
  •    linkobjs=\"$linkobjs $2\"; shift;;
    

ocamlc options

 -cc|-ccopt|-I|-w)
  •    camlopts="$camlopts $1 $2"; shift;;
    
  •    camlopts=\"$camlopts $1 $2\"; shift;;
    
    -cclib) lib=echo $2 | sed -e 's/^-l\(.*\)$/lib\1.lib/'
  •    linkobjs="$linkobjs $lib"
    
  •    linkobjs=\"$linkobjs $lib\"
       shift;;
    
    -linkall|-verbose)
  •    camlopts="$camlopts $1";;
    
  •    camlopts=\"$camlopts $1\";;
    

other options

  • -*) echo "Unknown option "$1", ignored" 1>&2;;
  • -*) echo "Unknown option \"$1\", ignored" 1>&2;;

files

  • *.cm[oa])
  •    camlobjs="$camlobjs $1";;
    
  • .obj|.lib)
  •    linkobjs="$linkobjs $1";;
    
  • $camlobjs_mask)
  •    camlobjs=\"$camlobjs $1\";;
    
  • $linkobjs_mask)
  •    linkobjs=\"$linkobjs $1\";;
    
    *.tlb)
    tlbcounter=expr $tlbcounter + 1
  •    echo "$tlbcounter typelib $1" >> $resourcefile;;
    
  • *) echo "Don't know what to do with "$1", ignored" 1>&2;;
  • esac
  •    echo \"$tlbcounter typelib $1\" >> $resourcefile;;
    
  • *) echo "Don't know what to do with \"$1\", ignored" 1>&2;;
  • esac"
    shift
    done

@@ -69,7 +83,7 @@
rm -f $resourcefile
fi

-ocamlc -custom -output-obj -o $camlobjfile $camlopts com.cma $camlobjs &&
+$ocamlc -output-obj -o $camlobjfile $camlopts $com_lib $camlobjs &&
link /nologo /incremental:no /dll /machine:ix86
/out:${output} /libpath:$camllib
/export:DllGetClassObject,@2,PRIVATE
@@ -79,7 +93,7 @@
$resfile
$linkopts $camlobjfile $linkobjs
${camllib}\cfactory.obj libcamlidl.lib \

  • libcamlrun.lib advapi32.lib ole32.lib oleaut32.lib
  • $camlruntime_lib advapi32.lib ole32.lib oleaut32.lib
    exitcode=$?
    rm -f $resfile $camlobjfile
    exit $exitcode
    [---cut---]

Hope to hear from you soon,
Dmitry

@vicuna
Copy link
Author

vicuna commented Apr 23, 2002

Comment author: administrator

Support for native compilation added 2002-04-22 by XL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant