Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Q: script langs that call libs w/o bindings

Name: Anonymous 2007-06-05 11:16 ID:1G226DtK

I read that tinyScheme can call libraries (.dll) without special bindings or other set-up for each library function you call.
Can any of the other script languages that get metioned here, like OCaml, do that?

Name: Anonymous 2007-06-05 11:40 ID:Heaven

C#

Name: Anonymous 2007-06-05 17:11 ID:tFjP0+ru

>>1
I'm not entirely sure of what are you talking about, but there are ways to load arbitrary DLLs and call their functions from most popular languages.

Name: Anonymous 2007-06-05 17:14 ID:Heaven

>>3
he obviously means without a bunch of extra crap.
which would mean you can do it in one line.
except in java, where that would mean you could do it in less than 1000 lines.

Name: Anonymous 2007-06-05 18:20 ID:gbo3bJ7p

Python's 'ctypes' module can do this without too much faggotry*. If I'm not mistaken it comes standard as of 2.5.
http://www.python.net/crew/theller/ctypes/tutorial.html


* FORCED INDENTATION OF CODE notwithstanding.

Name: Anonymous 2007-06-05 18:37 ID:633k4E6e

Yeah, Python 2.5 can do that. I found it pretty amusing when Ruby and (pre-ctypes) Python advocates made a big deal out of the ease of interoperability with C code and showed how, with mere 50 lines of wrapper code per function, you can do what is already provided for you with any language with a decent FFI.

At least SWIG takes most of the fail out of working with those languages, even though it is a solution for a problem that shouldn't exist in the first place.

Name: Anonymous 2007-06-05 21:00 ID:TP625B1a

libffi from gcc or cygwin seems to be the base on which ctypes, tinyScheme, and others build their wrapper-less FFI. Google shows various experiments with libffi in Ruby, Haskell, etc., but I'm still looking for a list of script languages that formally include libffi.

Name: Anonymous 2007-06-05 21:19 ID:Heaven

>>7
PROTIP: The word `script language' doesn't mean anything. It's a non-word created by clueless C++ fucktards to dismiss any language that would save 90% from the time they spend on micromanaging their trivial programs.

Name: Anonymous 2007-06-05 21:27 ID:Heaven

Thank you, PRO.
If the interpreter/compiler doesn't make a 300KB file called "a.exe", it's a script language to me.

Name: Anonymous 2007-06-05 21:50 ID:Heaven

>>9
Well, at least you aren't calling Haskell a ``script language''.

Name: Anonymous 2007-06-05 22:15 ID:Heaven

>>9
You can easily have an interpreter for C. Suddenly C is a script language.

Name: no_time_for_this !PH8cdFtMYg 2007-06-05 23:00 ID:Heaven

Which of these 2 topics will help you write programs?
   1. Defining "script language" very specifically.
   2. Knowing which interpreters and bytecode compilers can
      call .dll functions without making you write wrapper code.

Name: Anonymous 2007-06-06 8:09 ID:4wrgVT2e

PROTIP: The word `script language' does mean something. It's a word created by clueless C++ fucktards who are too lazy to create well-defined words because they have to deal with well defined things so often.

Name: Anonymous 2007-06-06 14:37 ID:6wxDKfqJ

>>1

Declare Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal lpClassName as String, ByVal lpWindowName as String) as Long

Name: Anonymous 2007-06-06 15:05 ID:Heaven

>>14
or other set-up for each library function you call.

Name: Anonymous 2007-06-06 16:09 ID:6wxDKfqJ

>>15

It's the same as ctypes, except ctypes lets you rape the stack by making up a prototype at runtime if you don't give it one.

Name: Anonymous 2007-06-06 17:54 ID:89SPhOJW

ctypes can only `do' stdcall and cdecl calls, so if your c function expects arguments in other format, like Microsoft's fastcall (first two args in ecx and edx, rest on stack), then there is no way to communicate that information to ctypes.
Plus don't expect to use ctypes for performance critical code, like opengl rendering, or what have you.

Name: Anonymous 2007-06-06 19:50 ID:VRtMp4KF

Protip: Never use the *A Win32 calls. Use the *W ones, or GTFO. Only stupid Japanese hentai game programmers use *A now.

Name: Anonymous 2007-06-06 20:19 ID:Heaven

>>15
A declaration is OK. Mainly we're trying to get away from using the C compiler for wrappers. You want to do ALL your work inside the script language.

>>17
Thanks for the warning. Now I need to find my notes on identifying the .dll function's type of call using the nm command. All I can remember now is that some of the symbols have numbers after them indicating the byte length of the parameter.

Name: Anonymous 2007-06-07 7:27 ID:Ra8euJam

If I were the lead Windows architect, (after dropping Vista and going back to Windows 2000 with some XP stuff) the next version of Windows would map all *A 8-shits functions to something like KillProcess(GetCurrentProcess(), KPFL_WITH_FIRE).

Name: Anonymous 2007-06-07 10:25 ID:Heaven

>>20
Make sure to retoractively add native unicode support to win9x while you're at it!

Name: Anonymous 2007-06-07 16:01 ID:Heaven

>>21
Even better, if we're rewriting the development history of Windows, scrap 9x altogether; it was a bad idea and got worse as time went on. (LOL ACTIVEX)

Instead, abandon the "user" products altogether after Win3.1, migrate *everybody* to Windows for Workgroups, and adopt WinNT as the sole platform to develop. Also don't call it something gay like Windows 2000. Use real version numbers like Windows NT 5.0.

Name: Anonymous 2007-06-08 3:52 ID:Heaven

>>22
Nice job staying on point, Goober. You probably didn't even think of starting a separate Unicode thread. Thanks for tossing more crap on the pile that is /prog/.

Name: Anonymous 2009-01-14 14:49

ASL?

Name: Anonymous 2010-10-26 20:38

Don't change these.
Name: Email:
Entire Thread Thread List